UPDATE - PHP SPEEDY WP: Speedy Wordpress Plugin now available!

PHP Speedy

PHP Speedy is a script that you can install on your web server to automatically speed up the download time of your web pages. Here’s an example, from a test page:

Before PHP Speedy - 14 requests that took 4.44 seconds

Before PHP Speedy

After PHP Speedy - 4 requests that took 1.1 seconds

Before PHP Speedy

PHP Speedy automatically joined together all the appropriate files and compressed them, greatly reducing the load time of the page. Let’s see what Yahoo’s Y-Slow makes of this:

Before PHP Speedy - Grade F (44)

Before PHP Speedy with YSlow

After PHP Speedy - Grade A (96)

Before PHP Speedy with YSlow

Don’t take my word for it

You can have a look at the test page for yourself:

Download

You can download PHP Speedy from this link: PHP Speedy 0.5.2 download

Installation - via auto-install

In order to install PHP Speedy you should:

  • Download and unzip the PHP Speedy package into its own directory
  • Point your browser to the PHP Speedy directory
  • Follow the installation instructions

Installation - manual

If you prefer to manually install things:

  • Download and unzip the PHP Speedy package into its own directory
  • Delete the index.php and install.php files
  • Open config.php
  • Fill in the blanks for the variables (apart from username and password). You might enter something like this:
    $compress_options['document_root'] = “/home/my_site/public_html”;
    $compress_options['javascript_cachedir'] = “/home/my_site/public_html/aciddrop/php_speedy/”;
    $compress_options['css_cachedir'] = “/home/my_site/public_html/aciddrop/php_speedy/”;
    $compress_options['minify']['javascript'] = “1″;
    etc
  • Make sure the directories you specified for the cachedirs are writable
  • For the GZIP, minify and expires options 1 is on and 0 is off
  • Open the php file that controls the output of HTML that you will be compressing. This might be something like index.php. Include the php_speedy.php file at the very top, i.e like this:
    require(’/home/my_site/public_html/aciddrop/php_speedy/php_speedy.php’);
  • Add this code at the very bottom $compressor->finish();

Stay up-to-date

I have some more killer features planned for PHP Speedy, so make sure you subscribe to my RSS feed to stay up-to-date.

Donate

If you found the script useful and it saved you some time, please consider donating. Any amount is fine.


  • Feb
  • 1
Jeromy
Jeromy

would this work on a wordpress installation?

  • Feb
  • 1
admin
Leon

Yes this works fine on WordPress. The script gives you instructions on how to set it up with WordPress on Stage 3 of the install process.

I am working on a Wordpress plugin though if you can wait a while longer.

  • Feb
  • 1
Larry Kubin

This looks badass and could really speed up some of my sites. I’m gonna check it out. Thanks!

  • Feb
  • 1
admin
Leon

Ok Larry, let me know how you get on and if you have any problems just shout.

  • Feb
  • 1
anonymisto
anonymisto

Any chance you could write up an install procedure for those of us who can’t or don’t care to use the automagic installer?

  • Feb
  • 1
admin
Leon

anonymisto, I have added some manual install instructions above.

  • Feb
  • 1
Jeromy
Jeromy

alright, I’ll try and hold off until a wordpress plugin - that would be fantastic!

  • Feb
  • 1
vfgs
vfgs

very high memory usage!!! gz_compress cache content is better than ob_start (”ob_gzhandler”);

  • Feb
  • 1
admin
Leon

thanks vfgs, I’ll have a look at gz_compress.

  • Feb
  • 1
Christina Warren

OK - I’m sure I’m missing something, but when I inserted this in my WordPress install per the automated instructions, the end result was that my CSS was disabled. Does something in my CSS need to be adjusted to take advantage of this?

  • Feb
  • 1
Christina Warren

And I didn’t have my php_speedy in the wordpress directory. Problem solved.

  • Feb
  • 1
Jon Gales
Jon Gales

All PHP files for public distribution should start their code with <?php, not <?. Short tags requires that PHP was compiled with it (–enable-short-tags) and as such many installations do not support it. Short tags get in the way of serving XML files and as such I have them disabled.

  • Feb
  • 2
Vikram

Leon, This is looking good really! I did check the web page load time in Fire-Bug, and I see improvement in the speed of web page loading.

You would make this job easier for a lot of guys if you could come up with a plugin for WordPress and other platforms as well.

I am testing it on one of my blogs now and would let you know If I face any issues!

Good Luck ….Great Job! :)

  • Feb
  • 2
Sepehr
Sepehr

Not works for me!
I’ve done all the steps described above,
but i just have a blank page on my site :(

  • Feb
  • 2
Carlos.Yamil
Carlos.Yamil

I`m using .htaccess to rewrite links and emulate folders. Will this work?

  • Feb
  • 2
Tyler

a wordpress plugin would be brilliant!

  • Feb
  • 2
Josh

I’m trying this out right now on my blog. I inserted the code before the get_header() function, but my get_footer() function is in my sidebar.php file and not my index.php file. I inserted the other code after the get_footer() function in my sidebar.php file. I don’t know if that makes any difference or not, but when I try running my page and I look at the source code, I am getting the error “Fatal Error: Call to a member function finish() on a non-object in /home/jjjunk/public_html/wp-content/themes/leia-en/sidebar.php on line 114.” Anyway to get that fixed?

  • Feb
  • 2
justin

I get the message “Rendering of template admin_container.php failed” when trying to use auto installer. I am using Wordpress 2.3. Any ideas for a fix? I could try the manual install but would like to see the auto install work.

  • Feb
  • 2
Alex

what about AJAX ?

  • Feb
  • 2
Alex

and what about complex php script, that can exit() with header(”Location: ….”); for example in middle part of PHP script ?
Do I should control this myself ?

  • Feb
  • 2
Jeromy
Jeromy

Hey man, just foolin’ around with tonight, immediately got this error trying the auto install:

Rendering of template admin_container.php failed

  • Feb
  • 2
Peppe

Hi, there is a problem for me: the script creates _cmp_* files with permission 644.

  • Feb
  • 2
admin
Leon

Christina - glad you got it working

Jon - Thanks for the tip, I’ll change it.

Vikram - I’m working on the wordpress plugin; the installer in PHP Speedy is the basis for the options screen in Wordpress. I’ll launch the WP Plugin next week. If other CMS’s/Blogs are requested, I can look into producing a plugin for them.

Sepehr - try turning off the option for page gzipping. Then at least you will see an error message.

Carlos - yes, it should work, after all Wordpress does this. As with any site though, I do recommend testing on a non-live page first though.

Tyler - it’s coming!

Josh - try putting both commands in your index.php. Or wait will next week for the WP plugin.

Justin - thanks for letting me know, I’m going to look into this now

Alex - yes! it compresses the JavaScript that powers your Ajax. And if your script is redirecting to another location then there’s nothing to compress, so don’t add the PHP Speedy code to that page.

Jeromy - I’m looking into it, thanks for letting me know.

Peppe - what’s wrong with that?

  • Feb
  • 2
Scott
Scott

My wordpress site uses the K2 theme, and everything seems to work right except for one thing. When I click on a tag or category, the page that it returns is completely blank. Wondering if I am doing something wrong, or if there is an incompatibility.

  • Feb
  • 2
David

During the installation I keep getting “undefined index” errors, which I know is due to the security level of my host. These are usually just information messages, but after installation the example demonstration is just full of errors along with some seemingly random characters at the end. Are you able to help?

  • Feb
  • 2
admin
Leon

New version available for download:

0.4.2 - Added variable initialisation to prevent notice errors
- Changed CSS and JS compression to gzcompress
- Added some more checks for correct path
- Changed to full PHP tags

Please let me know how you get on!

  • Feb
  • 2
admin
Leon

Scott - turn off page gzipping, at least then you’ll get an error message back.

David - this should be fixed in the latest version (0.4.2). If you still get any errors please let me know.

  • Feb
  • 2
Jonathan Blackburn
Jonathan Blackburn

will it work on drupal?

  • Feb
  • 2
Bob
Bob

Hi Leon, I’ve been working on integrating PHPSpeedy with PivotX (www.pivotx.net), and so far it works very nice. A few comments:

- I really dislike Output Buffering. Maybe it’s not rational, but i just try to avoid it, because it can introduce problems later on which might be hard to track down once they start popping up. Because of this i’ve added a ‘compress’ method, so now i can do:

$html = $compressor->compress($html);

This will do almost the same as $compressor->finish(), except it takes a string as argument, and doesn’t echo it, but returns it.

This way you can integrate php speedy without the need for output buffering, as long as the application you’re adding it to doesn’t just print() it’s output as it goes.

- The issue Sepehr noted is likely not because of the gzipping, but because of the javascript minifying. I haven’t looked at the code for that thoroughly yet, but the PHP memory limit needs to be set to 32Mb minimum to handle 200kb of javascript in my case. If it runs out, it stops without giving a proper error.

Perhaps it can be modified to die more elegantly?

Anyhow, keep up the good work! This is a great script!

  • Feb
  • 2
Alexandre Plennevaux

hi leon,
thanks for this super useful script. i managed to get it working, yet i noticed that it doesn’t include CSS files loaded as @import url(http://www…)

also, in trying to add it to my wordpress blog, i included the codes in the my_theme/index.php file, but got this error. I’m using wordpress2.3 on a php5/mysql5 server

Fatal error: Uncaught exception ‘JSMinException’ with message ‘Unterminated string literal.’ in /var/www/pixeline/public_html/_lib/php_speedy/libs/php/jsmin.php:94 Stack trace: #0 /var/www/pixeline/public_html/_lib/php_speedy/libs/php/jsmin.php(178): JSMin->action(2) #1 /var/www/pixeline/public_html/_lib/php_speedy/libs/php/jsmin.php(64): JSMin->jsmin() #2 /var/www/pixeline/public_html/_lib/php_speedy/controller/compressor.php(353): JSMin::minify(’/*??Cross-Brows…’) #3 /var/www/pixeline/public_html/_lib/php_speedy/controller/compressor.php(132): compressor->do_compress(Array, ‘javascript(Array, ‘javascript’) #5 /var/www/pixeline/public_html/blog/wp-content/themes/pixeline/index.php(67): compressor->finish() #6 /var/www/pixeline/public_html/blog/wp-includes/template-loader.php(20): include(’/var/www/pixeli…’) #7 /var/www/pixeline/public_html/blog/wp-blog-header.php(21): require_once(’/var/www/pixeli…’) #8 in /var/www/pixeline/public_html/_lib/php_speedy/libs/php/jsmin.php on line 94

  • Feb
  • 2
LoLo

cool idea !

  • Feb
  • 3
Ajith
Ajith

Hi Leon,

I’m pretty excited about using this for my SugarCRM installation. Each page request uses about 30-40 js and css files becuase it was designed to be very modular and customizable. The performace cost is obvious, so I was glad to run into php_speedy.

I got it installed ok, and the test page works fine, but it doesn’t actually seem to be doing anything for my sugar install. All requests go through my index.php where I added the require php_speedy, and $compressor-finish() lines.

I added some debug output to the finish() function, and tried to inspect the data in $this->content, but its blank. My debug statement appears at the end of my page, and nothing was echoed after that.

I’m not sure how php_speedy is supposed to intercept the content to manipulate it and then finally echo it in finish(), but it doesn’t seem to work the way my sugar pages are writing thier output.

So it seems logical that php_speedy isn’t doing anything in my case becuase it hasn’t captured any of the output of my php pages, so it has no text to operate on.

Any ideas?

  • Feb
  • 3
Pavel

I was wondering how to install this for pixelpost (photoblogging software)? It works on the same principle as wordpress (i.e. there is an index.php file and a template file). My problem is with where to put the include and compress statements. The end of pixelpost’s file basically echoes the template, so where is phpspeedy supposed to go?

  • Feb
  • 3
Peter

Just tried installing on 0.4.2 on a Dreamhost server. Nothing works at all, even the test page.

  • Feb
  • 3
hell-world

oww Nice!

this work on a wordpress installation?

  • Feb
  • 3
Corey
Corey

Odd issue occurring for me…
When I initially load the page all of the AJAX like javascript works fine. When I reload or navigate to another page (such as from product.php?id=1 to product.php?id=2) the javascript stops working (ie. lightbox, ajax load, etc.)

Any thoughts?

  • Feb
  • 3
justin

It seems my previous problem with “Rendering of template admin_container.php failed” during auto installation was due to an incomplete ftp transfer up to my host. It is now fixed.

I am now experiencing the same problem as Scott. I get a blank page when clicking on a category or a link to the actual article. I turned of gzipping (using 0.4.2) for the page and it then worked correctly. I would like to be able to get the benefit of gzipped pages. I am using Silhouette theme in
Wordpress 2.3. Any thoughts?

  • Feb
  • 4
Tanc

Hi Leon, this looks interesting and I’m trying to implement it in Drupal at the moment. I’ve installed it in the template, using your test page as a guide, so that the include statement is at the top (and is called on every page view) and the compressor command is at the bottom of the template. The paths are all set up and correct in the config file. The result is that a single php file is created in the cache folder containing only the minified JS for the site. This JS is broken and no javascript appears to work in the Drupal site because of this. The CSS isn’t cached (according to yslow) or compressed.

This could make an excellent edition to Drupal’s built in caching, any chance of getting it working with Drupal? Let me know if you’d like more help with the Drupal side of things.

  • Feb
  • 4
admin
Leon

Jonathan - I haven't tested it on Drupal. I'll give it a go when I have a moment.

Bob - Good idea, I've added that in. Thanks for the heads up on the JavaScript minification. I'll lower my memory limit and investigate.

Alexandre - no it doesn't work with import@ yet, thanks for the suggestion. The error looks like it could be a problem with your JavaScript. Try running it through JSLint to see if it has any problems: http://www.jslint.com/

Ajith - trying turning off page gzipping and see if you get an error message. Otherwise, you could try increasing your PHP memory limit.

Pavel - PHP Speedy should be included right at the very top, and at the very bottom after the file echoes the template. It works by capturing the output buffer so it's supposed to be called after the final echo.

Peter - try turning off page gzipping and see if you get an error message.

hell-world - yes.

Corey - have a look at the source code of the page where it's working (View | Source in your browser) and also of the pages where it's not working. Is the JavaScipt being included differently?

Justin - I've added in some extra checks for the gzipping. Please try it again now.

Tanc - I've added in new function to the compressor class at Bob's suggestion (above). This means that instead of running $compressor->finish() you can compress any output directly with $compressor-compress($your_content). So for Drupal you could run something like this at the end of index.php:

CODE:
print $compressor->compress(theme('page', $return));

  • Feb
  • 4
Christoph Voigt

Great to see you working on a WP plugin :) I gave it a try too but as I'm not that good in PHP and lack the time to wrap my head around it, the project has stopped completely :D

Before releasing the plugin, could you double-check for compatibility with plugins like WP-Cache? Might or might not create complications.

  • Feb
  • 4
Licatropo
Licatropo

??? Does it works ... I'm looking at the final html files in cache and ... is the same and testing it with firebug... and gess what... is the same, please could you tell me what to do??

  • Feb
  • 4
Ajith
Ajith

Leon - I did turn off all the gzipping in the config, and I did not see any error messages. I think I'll test this compress on-the-fly feature you just added next.

Peter - I'm running my stuff on Dreamhost as well. The test page works fine. I'm just having trouble with my specific app. I am using php5 though. IIRC, Dreahost uses php4 by default. I compiled my own php5 for some compatibility issues I had with some of my software. Perhaps that might produce different results.

  • Feb
  • 4
Redemption

Hi, in my blog it does't work.. i've install php spedy, and i've try many combination of configuration but it work only with all config on "no" ...

If i try to compress java for example, the slide bar don't work. The same thing append with a css compression...

If i try all configuration option on "yes" the page give a lot of time to charge and at the end appear the page error 500 ...

  • Feb
  • 4
Curtis

I can't enable JavaScript compression.
http://pyr2.nmsu.edu/~cwyatt/map/

The _cmp_javascript_ file exists on the server. However when I try to get it through a web browser, it returns a blank file. The CSS compression works fine and the settings for CSS and Javascript compression are the same. Any ideas?

  • Feb
  • 5
zParacha

Hi Leon, I installed this on my Wordpress blog. I think some thing is not right. On the test page I cannot slide the horizontal slider and all CSS text is same black color on white background. I used all default options. Can you help me with this?

Regards.

  • Feb
  • 5
admin
Leon

Redemption - I've had a quick look at your blog, and I think it may have a problem with one of the plugins:

CODE:
<script type="text/javascript" src="http://www.pausaxn.it/wp-content/plugins/quoter/quoter.php?js=1"></script>

The script couldn't compress JS that in outputted by a PHP file. I have added in a fix for this, so please try again now.

Curtis - I have had a look through my code and managed to find a bug that might be causing your problem. Please try again with the latest version (0.4.4). If that doesn't work, open up the _cmp_javascript file in a text editor - what does it contain?

zParacha - please try the lastest version (0.4.4). If it still doesn't work on the test page, what do you see when you view the source of the test page?

  • Feb
  • 5
Peppe

@Hi, there is a problem for me: the script creates _cmp_* files with permission 644. @You: Peppe - what’s wrong with that?

With permission 644 to this files, my host can't read the files.
If i change to 755 all works fine, but then the script re-writes.

  • Feb
  • 5
Redemption

I've try with new release in my site and the page full loading but there isn't any change with yslow and also the page give error with css. I've made ths screeshot with all option active http://img228.imageshack.us/img228/5079/90000292dr4.jpg

..i've test with different option but the result never change.

There is problem with permission? my actual permission are directory 750, files 640

  • Feb
  • 6
Claudio

Hi Leon,

I installed it in my Wordpress blog. It works good, apart from the fact that it outputs the string "null" on the top of the site (and of the test page).

Any idea how can I remote the string?

I used version 0.4.4

  • Feb
  • 6
Massimo

Hi Leon,
I'm testing php-speed in groupoffice in a windows environment. I find some problem because my application is not running directly under the main Apache document_root, but it is defined as alias in the httpd.conf file. I add some additional information in the config file to specify the correct path, and it work properly !

But I find out a bug ... once css and js files are cached there is a problem when the script tries to remove the [script] tags

in compressor.php, if the $array_script contains a [script] tag without SRC tag you remove the key from array

//Make sure src element present
foreach($script_array AS $key=>$value) {
if(!strstr($value,$options['src'])) {
unset($script_array[$key]);
}
}

the you call a _remove_scripts funcition that fails if some key in $script_array is missing.

function _remove_scripts($script_array,$source) {
foreach($script_array AS $key=>$value) {
if($key == count($script_array)-1) { //Remove script
$source = str_replace($value,"@@marker@@",$source);
} else {
$source = str_replace($value,"",$source);
}
}
return $source;
}

you must change this function in this way:

function _remove_scripts($script_array,$source) {
foreach($script_array AS $key=>$value) {
$source = str_replace("@@marker@@", "",$source);
$source = str_replace($value,"@@marker@@",$source);
}
return $source;
}

  • Feb
  • 6
Begreeny

Dear Leon,

I tried your last version (0.4.5), and the test page is'nt works on my page (no css and javascript).

My settings:
Document root: /nfs/extra/b/be/begreeny/wwwroot (detected: /nfs/extra/b/be/begreeny// )
cache dirs: /nfs/extra/b/be/begreeny/wwwroot/t/php_speedy/

The requests in the test page e.g. a javascript file:

CODE:
http://begreeny.com//nfs/extra/b/be/begreeny/wwwroot/t/php_speedy/_cmp_javascript_36004c76bc8358d9aba7848d70c44f80.php

The good url is:

CODE:
http://begreeny.com/t/php_speedy/_cmp_javascript_36004c76bc8358d9aba7848d70c44f80.php

Thanks for your hard work.

  • Feb
  • 6
admin
Leon

Peppe - the latest version (0.4.5) sets the permissions to 755.

Redemption - please try with the latest version

Claudio - please try with the latest version

  • Feb
  • 6
admin
Leon

Massimo - thanks for the tip, I'll have a look at your fix.

Begreeny - are the _cmp_ files created in /nfs/extra/b/be/begreeny/wwwroot/t/php_speedy/ ?

  • Feb
  • 6
Begreeny

Yes:
In /nfs/extra/b/be/begreeny/wwwroot/t/php_speedy/ there are:

_cmp_cssalternatehandheld_78216aec20bd80b77d5428868ee0b006.php
_cmp_cssalternateprint_965a7f83b73a7ecb5df94a5de2db605f.php
_cmp_cssstylesheet_86ad7f58e44312e03da62ddd5d93e4cc.php
_cmp_cssstylesheetprint_17380c3440fce66100eb1c2fecca4ce5.php
_cmp_javascript_36004c76bc8358d9aba7848d70c44f80.php

  • Feb
  • 6
admin
Leon

Begreeny - Perhaps you could email me the output from print_r($_SERVER) and your PHP Speedy config.php and I'll try to figure it out. leon at aciddrop.com. Thanks!

  • Feb
  • 6
Redemption

@ Leon :
I've try this new version but it does't work... same thing 0.4.4

  • Feb
  • 6
Curtis

@ Leon:
I have installed the latest version (0.4.5), but now it ignores my Javascript completely and doessn't compress it at all. All it does is the CSS. Also, I think it would be better if all the compression was put into /php_speedy/cache instead of directly in the php_speedy folder.

  • Feb
  • 6
admin
Leon

Curtis - there is a problem with PHP files that output JavaScript: PHP Speedy can't get the file contents from the server because it contains PHP. It would have to get the contents from a HTTP connection, but that's for another version (maybe). For the moment, only .js JavaScipt files containing JS code are supported.

  • Feb
  • 6
admin
Leon

Curtis - oh, and you can set the cache directory yourself in the installer.

  • Feb
  • 6
admin
Leon

Redemption: what are the contents of your HEAD before and after using PHP Speedy?

  • Feb
  • 6
Curtis

@ Leon:
Cache directory: Yeah, I just thought doing it as a default might be a good idea.

Ok. I didn't realize fopen or file_get_contents parsed the php before returning the contents of the file. (I didn't look at the code but I'm assuming that is what is going on.) I will wait for the day when it is possible :).

  • Feb
  • 6
Redemption

Now the css work fine(my mistake) but the result never change 21...

this is Head

Before

CODE:
PausaXn - Pausa Perenne.it - Dove si parla di tutto tranne che di lavoro…Video, immagini, foto e curiosità dal mondo!

<!-- ****STATISTICHE*** -->

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-2166967-1");
pageTracker._initData();
pageTracker._trackPageview();

<!-- ****FINE STATISTICHE*** -->

   
   
   
   
   
   
   
   
   
   
 
    <!-- Added By Democracy Plugin. Version 2.0.1 -->
   
   
   

<!-- Start Of Script Generated By WP-PageNavi 2.20 -->

<!-- End Of Script Generated By WP-PageNavi 2.20 -->

<!-- Added by Quoter plugin v1.1 -->

.commentlist blockquote cite { /* Fix for Kubrik theme */
    display: inline;
}

.recentcomments a{display:inline !important;padding: 0 !important;margin: 0 !important;}

after

CODE:
PausaXn - Pausa Perenne.it - Dove si parla di tutto tranne che di lavoro…Video, immagini, foto e curiosità dal mondo!

<!-- ****STATISTICHE*** -->

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-2166967-1");
pageTracker._initData();
pageTracker._trackPageview();

<!-- ****FINE STATISTICHE*** -->

   
   
   
   
   
   
   
   
   
   
 
    <!-- Added By Democracy Plugin. Version 2.0.1 -->
   
   
   

<!-- Start Of Script Generated By WP-PageNavi 2.20 -->

<!-- End Of Script Generated By WP-PageNavi 2.20 -->

<!-- Added by Quoter plugin v1.1 -->

.commentlist blockquote cite { /* Fix for Kubrik theme */
    display: inline;
}

.recentcomments a{display:inline !important;padding: 0 !important;margin: 0 !important;}

  • Feb
  • 6
Redemption

I've made a mistake, css work fine with ie7 but with firefox no..
this is is the code after php-spedey active.

CODE:
PausaXn - Pausa Perenne.it - Dove si parla di tutto tranne che di lavoro…Video, immagini, foto e curiosità dal mondo!

<!-- ****STATISTICHE*** -->

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-2166967-1");
pageTracker._initData();
pageTracker._trackPageview();

<!-- ****FINE STATISTICHE*** -->

 
<!-- Added By Democracy Plugin. Version 2.0.1 -->

<!-- Start Of Script Generated By WP-PageNavi 2.20 -->
<!-- End Of Script Generated By WP-PageNavi 2.20 -->
<!-- Added by Quoter plugin v1.1 -->

.commentlist blockquote cite { /* Fix for Kubrik theme */
display: inline;
}

.recentcomments a{display:inline !important;padding: 0 !important;margin: 0 !important;}

  • Feb
  • 6
Redemption

(I've post the code)

  • Feb
  • 6
Cat
Cat

Does this script work with HTML?

  • Feb
  • 7
kaydubbleu

How would you tackle the problem of different sets of javascript for different pages within one site?

For example a form that requires 1 set of javascript functions for Fruit Sales and another form with a different javascript set for Vegetable Sales.

When the fruit page is requested, the fruit javascript library is compressed and cached. Then if the vegetable page is requested the vegetable library is compressed and overwrites the cached fruit library.

When multiple users are requesting the different pages simultaneously the files are just being constantly rewritten.

  • Feb
  • 7
Samsul

I'm curious, does this plug in permit robot/crawler to read all the HTML text? Because I tried and installed the script and when I check my blog with keyword analyzer on the web, it seems like the analyzer can't read what inside my HTML. Is it because it's compressed? Where does this compressed HTML being decompressed? At the client side?

  • Feb
  • 7
Alex

what about "smart ass" JS code, that load another JS parts, imgs , etc ?

  • Feb
  • 8
andy
andy

hi, i had a problem with the name of the cached css file. it contained %2c, a comma. however, the browser wanted it to be loaded as %252c (encoding the percent sign as %25).

anyway, to resolve the issue, i edited line 340 of compressor.php to the following:

$cache_file = '_cmp_' . preg_replace('/[^a-zA-z0-9]/', '', $options['save_name']) . '_' . md5(implode("_",$script_array).$datestring.implode("_",$options));

it just uses a regexp to strip out non-alphanumeric characters.

the script works well now for css, but for some reason isn't minifying js yet...

good work though
andy

  • Feb
  • 8
admin
Leon

Alex - no I'm afraid that's no supported.

andy - thanks for the fix. The JS minify only works on PHP5+ as the jsmin library it uses requires that. Perhaps that's the problem.

  • Feb
  • 8
andy
andy

ok, the reason it wasn't minifying js was because my js is included right at the end of the body. so i modified get_script_array so it didn't call get_head, and it worked (well, actually, the combined js doesn't work, but the compressor is working at least).

thanks again

  • Feb
  • 8
admin
Leon

OK, I see. Well it's really intended for JS that's all in the same location in the order of the page, as it combines all the scripts into the same file. If changing get_head to get_entire_page works for you though, well, go for it ;-)

Try running the JS through JSLint to check for any problems.

  • Feb
  • 8
tom rojers
tom rojers

good work leon.

i was just thinking about how the files are cached. it's not very efficient. a better way would be as follows:

if it's combining and compressing js files, the class could stat each file being combined to get the last modified time. these could then be used as the filename for the cached version (separated by underscores or themselves md5-ed).

doing it this way means it would be faster to find out if there is already a cached version of the javascripts, without having to minify them all and use an md5.

thx tom

  • Feb
  • 9
Josh

Seems like your version 0.4.5 is working better on my blog. I have all the options enabled and everything loads fine. My blog loads faster too, but some things don't seem to be working. It's at least initially loading at about 5 sec instead of the 10 sec it would normally take. I think most of my problem is that some of the javascript isn't in the head.

Thanks for making php_speedy. I'll be looking forward to more updates.

  • Feb
  • 9
agung
agung

I'm about to install it. but is there anyway to disable it or like uninstall it?

  • Feb
  • 9
agung
agung

would php_speedy still affect my blog's load time if i had all the options turned off?

  • Feb
  • 9
jujol

Hi, i have a problen to use the program in wordpress.
After install this is the output:

Warning: Invalid argument supplied for foreach() in /home/jujol0/public_html/php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in /home/jujol0/public_html/php_speedy/controller/compressor.php on line 563

Warning: implode() [function.implode]: Bad arguments. in /home/jujol0/public_html/php_speedy/controller/compressor.php on line 344

Warning: Invalid argument supplied for foreach() in /home/jujol0/public_html/php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in /home/jujol0/public_html/php_speedy/controller/compressor.php on line 563

Warning: Cannot modify header information - headers already sent by (output started at /home/jujol0/public_html/php_speedy/controller/compressor.php:556) in /home/jujol0/public_html/php_speedy/controller/compressor.php on line 315

Can you help me to solve the problem?

  • Feb
  • 10
Cliff

Is there an uninstall procedure? I have removed the cache, removed the files and I'm still getting cached data.

  • Feb
  • 11
andy
andy

i've made greater savings by packing js instead of minifying it.

here's a version of dean edwards' packer in php:

http://joliclic.free.fr/php/javascript-packer/en/

it's easy to switch from minifying to packing

  • Feb
  • 11
andy
andy

...and also adding the following to minify_text makes even smaller css files:

// strip spaces after certain characters
$txt = preg_replace('/\s*(,|;|:|{|})\s/', '$1', $txt);

  • Feb
  • 12
Daniel

Andy, how did you get Dean's packer in? and which file did you add that text to?

  • Feb
  • 12
Jeremy
Jeremy

I keep getting the class not found error...no idea why. Test page works fine...

  • Feb
  • 12
admin
Leon

tom - that's exactly how it works! The md5 in the filenames in the last modified time of each file together. If the md5 is the same as the current files, no more work is done by the script.

agung - to uninstall just delete the php_speedy directory and remove the code you added to your script(s). If all options are off it wouldn't do anything.

jujol - please try the lastest version 0.4.6. Does the test page work OK? What do you have in the HEAD part of your HTML?

Cliff - remove the code that you added to your script. Make sure the page isn't cached.

andy - The reason I avoided packer is because the code requirements are stricter, but thanks for the info.

Jeremy - make sure you are including the compressor class with the correct path. The lastest version (0.4.6) may help too.

  • Feb
  • 12
admin
Leon

Redemption - try running the JavaScript through JSLint:
http://www.jslint.com/

  • Feb
  • 12
Jeremy
Jeremy

Well, I can get the page to stop displaying the error. But it doesn't display anything at all now. Just a blank page. 0.4.1 worked with the same setup, but 0.4.5 and 0.4.6 have not worked.

  • Feb
  • 12
begeeny

Dear Leon,

Thanks for your fixes. The 0.4.6 version works perfetly on my blog!

  • Feb
  • 12
Jeremy
Jeremy

http://jeremy.tymes.name/ is my example.
It returns 3KB of something, but it isn't being outputted the right way (not at all). I use the installer to do everything, and like I said 0.4.1 worked.

  • Feb
  • 12
admin
Leon

Jeremy - what does the HEAD of the document contain?

  • Feb
  • 13
risto
risto

Gzip options for javascript and CSS is not working for me. Any idea why ?
The test page dont show any CSS nor the main page. Gzip page is working.
Thanks for the help.

  • Feb
  • 13
tom
tom

well done leon, you're one step ahead of me!

  • Feb
  • 13
andy
andy

daniel, to use the packer instead, i put class.JavaScriptPacker.php into libs/php, then search for:

$contents = $this->jsmin->minify($contents);

and replace it with:

$path = dirname(__FILE__);
require_once($path.'/../libs/php/class.JavaScriptPacker.php');
$packer = new JavaScriptPacker($contents, 'Normal', true, false);
$contents = $packer->pack();

in controller/compressor.php

good luck

  • Feb
  • 13
Jeremy
Jeremy

http://jeremy.tymes.name/head.txt

This isn't the original site I was running it on, but I tried it on this site and it still didn't work...so here's the header of that...I have inline Javascript and CSS because I was lazy when I made the site...but I would think that it'd still work.

  • Feb
  • 14
Licantropo
Licantropo

Hi I have a big problem of cache
I have a script to upload images and change the images that is working I see in the the hosting the images are ok, but in EI or FireFox I have the same old image, in the configuration file I'm using:
## Minify options
$compress_options['minify']['javascript'] = "1";
$compress_options['minify']['page'] = "0";
$compress_options['minify']['css'] = "1";
## Gzip options
$compress_options['gzip']['javascript'] = "1";
$compress_options['gzip']['page'] = "0";
$compress_options['gzip']['css'] = "1";

But I can't see the images....

  • Feb
  • 14
admin
Leon

Jeremy - actually, the latest version doesn't work with inline JavaScript and CSS. It was causing quite a few problems, so I changed the script to only work with CSS and JS with .css and .js extensions. Just create separate files and all should be OK again.

  • Feb
  • 14
admin
Leon

Licantropo - are you talking about CSS background images? What does the source of the page with the images look like before and after PHP Speedy?

  • Feb
  • 15
andy
andy

leon, i've found another bug. if you use $compressor->ignore(), files containing the given string are ignored, but the rest of the files aren't combined and included. it can be fixed by modifying _remove_scripts as below:

function _remove_scripts($script_array,$source) {

$maxKey = array_pop(array_keys($script_array));

foreach($script_array AS $key=>$value) {
if($key == $maxKey) { //Remove script
$source = str_replace($value['location'],"@@marker@@",$source);
} else {
$source = str_replace($value['location'],"",$source);
}

}
return $source;

}

  • Feb
  • 15
Matej

I love php speedy. It's one of the most useful piecese of code I have seen and used.

I found a bug in css processing. When I'm using YUI libraries (http://developer.yahoo.com/yui/) it messes up some background url paths.

When I'm using datatables and buttons libs in the same page it changes urls of backgrounds.

good example:
.yui-skin-sam .yui-dt-table th {
background:transparent url(/path/to/assets/skins/sam/sprite.png) repeat-x scroll 0pt;
}

I get something like:
.yui-skin-sam .yui-dt-table th {
background:transparent url(/path/to/path/to/path/to/path/to../../../../../sprite.png) repeat-x scroll 0pt;
}

  • Feb
  • 19
admin
Leon

andy and Matej - many thanks for the bug reports! I will test them and fix as soon as I have a moment.

  • Feb
  • 19
Tyler Mitchell

I'm using Joomla 1.0.13 and whenever I login on the frontend as a user I'm getting
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

--------------------------------------------------------------------------------

Apache/1.3.33 Server at massageinmytown.net Port 80

Whenever I disable the mambot the problem goes away.

  • Feb
  • 20
charles

leon

i run wordpress 2.3.3
i installed speedy

when i "view" the site i get:
1람����A�6�D���vk�*��e�)v �M���7D�ȸ\�����7���Š�a`Ճa�H"Ƥj��й�QUӽ�Z��� '��hlUU3��(S�^3-��(����jz�/��D�GҒ�� �ɛ�5y�h�M.��rl;��'�'�]��G�"��0�i��K������Yu��o�5��x���22 _�yރu�2+O���E���^ߨ�~������K[�Tk�՚?W�ύY��ӧ�y����k�N��\AQ�& ��Y���t\pw��ʌ�k,�̦��+Sݭ�(����b�?GF'^� ��޷?��Ŀm�JF��q���y���~���9��s��6���&�-8����9�t��R숊�bZqe wt�"�k�t���C�n���Y���^��.zI

please help urgently

  • Feb
  • 20
admin
Leon

Charles - edit config.php in the speedy directory and turn off page gzipping. The page should now display, and you'll probably get an error message that you can now fix.

  • Feb
  • 23
Massimo Nero

Hello Leon, I have a simply question about this "jewel" :)
Seo is compromised or not change, after install Php Speedy?
Thanks for your work!

Massimo

  • Feb
  • 24
John
John

When you install on the demo page what are the calls to these 2 files that are not incuded in the release ?

And my demo test page only ranked Performance Grade: B (83) is that right I throught it would make it to a A :-P

A 1. Make fewer HTTP requests
F 2. Use a CDN
F 3. Add an Expires header
A 4. Gzip components
A 5. Put CSS at the top
A 6. Put JS at the bottom
A 7. Avoid CSS expressions
n/a 8. Make JS and CSS external
A 9. Reduce DNS lookups
A 10. Minify JS
A 11. Avoid redirects
A 12. Remove duplicate scripts
F 13. Configure ETags

But I have eveything turned on so not sure why in the demo images it scores A

  • Feb
  • 24
bundle
bundle

Great work! I'm wondering how this might be used on a regular, non-WordPress site. Is that possible even though all my files are html and not php? Or is this only for WordPress?

Thanks.

  • Feb
  • 24
PJ
PJ

when is the wordpress plugin coming

  • Feb
  • 24
thomas
thomas

hi there,

i'm getting the following errors in joomla :( i have the latest version from speedy. my header is

Warning: Invalid argument supplied for foreach() in /php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in php_speedy/controller/compressor.php on line 563

Warning: implode() [function.implode]: Bad arguments. in php_speedy/controller/compressor.php on line 344

Warning: Invalid argument supplied for foreach() in php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in php_speedy/controller/compressor.php on line 563

  • Feb
  • 25
Perry
Perry

Here's a question.. I installed the software, and I'm getting erratic results. Works like a charm on my home page (wordpress 2.0.11)

However, your installation notes say:

"Now should should add the PHP Speedy code to your own PHP page. This is made a lot easier if you have one PHP file that serves every page in your site. In a Wordpress 2.3 blog, for example, this would be the index.php file for your theme. Because index.php is accessed for every page, we just have to modify that file. If you have different PHP files serving different pages, then you will need to modify each of those pages."

I modified that extra php pages as you indicated (such as archives.php, category.php, etc.), but those pages that are served very poorly.

When I go to those pages, I get an "ill" looking pages, almost straight HTML old school style.. it's missing something (not sure what.. style.css, or whatever)

Any clue what to do? Should I clear any caches on the server (such as WP-cache) or reboot or restart? Http & mysql, etc?

Please advise

  • Feb
  • 25
Perry
Perry

I should add a couple more things..

I have the following employed on the server as well:

- eAccelerator http cache
- Varnish HTTP proxy (which splits logged in users to port 80, non-logged in users to port 81)

Also on the wordpress installation are wp-cache and plugin-output-cache.

However, I don't think those are the problems. Using PHP Speedy, it seems only my CSS isn't working. When using firbug, it doesn't find any style.css for my site.

Your thoughts?

  • Feb
  • 25
Perry
Perry

Ok, I have yet a third post here.

I got it semi "working" by not messing with gzip or minify on the CSS.

However, checking my YSlow, it said many .js files were not minified... making me think that the way my theme is designed, that there may be an issue.

For instance, my index file just calls the various parts of the site, such as this very simplified example...

My question should be then, should I add the PHP Speedy code to each and every component on my site? Such as the sidebar, post, page, etc?

Because the index.php file in particular, has no Javascript calls in it, only the internal components of the site do, such as the post.php and sidebars...

Please advise, and it's great to see tools like this around!

Thanks!

  • Feb
  • 25
louis w
louis w

Do you have a version which does not require you to use the install wizard? I would like the php files to reside outside of my html root and would like to install it manually.

  • Feb
  • 26
louis w
louis w

How come you are changing the $_SERVER['DOCUMENT_ROOT'] (line 37 of compressor.php)? This is set by the server, why don't you just the document root instead of making users set it in the config.

Also the JS and CSS cache paths would be nice to not have to be full paths. You could just tack them on to the end of $_SERVER['DOCUMENT_ROOT'] to allow for easier maintenance and flexibility.

  • Feb
  • 26
louis w
louis w

Also I am seeing these errors:

STRICT : XXX/php_speedy/jsmin.php : LINE 167
Redefining already defined constructor for class JSMin
NOTICE : XXX/php_speedy/compressor.php : LINE 277
Undefined index: HTTP_ACCEPT_ENCODING

  • Feb
  • 27
David C
David C

I am getting this error:
Fatal error: Call to a member function set_paths() on a non-object in /public/php_speedy/controller/compressor.php on line 38

Also since the page I am working on has no scripts or CSS I get a bunch of errors about foreach loops in compressor.php if I don't specify that the compressor shouldn't do scripts or CSS.

  • Feb
  • 28
admin
Leon

Massimo - no, it doesn't affect SEO.

John - which two files? When a page contains multiple elements, it becomes harder to hit the 90's. It's easier for my test page, because it doesn't have so many page elements. I'm working on improving PHP Speedy so it improves page elements other than JS and CSS (hint: background images).

bundle - it's not only for Wordpress, but you do need PHP I'm afraid.

PJ - I'm about 1/2 way through it. Soon, please be patient!

thomas - that looks like it's not finding any scripts in your document HEAD. What does the HEAD contain?

Perry - yes, it sounds like it's lacking the CSS. You should only need to apply it to one file. What does your document HEAD contain before and after applying Speedy?

louis - I did initially. However, the document_root can be misleading. It can be set to say, /home/user/www/, but the user can choose to serve HTML from /home/user/www/content/. By explicity setting the document_root, I wanted to help the people who were having problems with their paths. Again, for the JS and CSS cachedirs I wanted to have full fexbility, hence the full paths. Thanks for the STRICT and NOTICE errors, I will look into them.

David - strange error - is the libs/php/view.php file present? (it is included from the php_speedy.php file). Thanks for the other error report, I will fix that.

  • Feb
  • 28
David C
David C

Yes, libs/php/view.php exists.

  • Feb
  • 28
David C
David C

Oh and these are the foreach loop errors I had mentioned (There is also an Invalid arguments error as an added bonus):

Warning: Invalid argument supplied for foreach() in /public/php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in /public/php_speedy/controller/compressor.php on line 563

Warning: implode() [function.implode]: Invalid arguments passed in /public/php_speedy/controller/compressor.php on line 344

Warning: Invalid argument supplied for foreach() in /public/php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in /public/php_speedy/controller/compressor.php on line 563

  • Feb
  • 29
Josef
Josef

Wondering what "username and password" are used for? Can these two options be left empty? If not, what are they referring to?

  • Feb
  • 29
admin
Leon

David C - what are the contents of the HEAD of your webpage (feel free to link to the page if you like)? How are you including PHP Speedy in your PHP?

Josef - this is to protect your PHP Speedy install directory. Otherwise someone could come along and change your PHP Speedy settings!

  • Feb
  • 29
Josef
Josef

thanks for the information !

the PHP_Speedy Install directory? means the directory where all the php-speedy files are residing in? which means that this directory needs to be protected by means of .htaccess?

or will just filling in the username and password automatically do the protection?

  • Mar
  • 1
David C
David C

This is just a test page so I don't have any CSS or scripts on it.
I am including PHP Speedy with this:

require('/public/php_speedy/php_speedy.php');
$compressor = new compressor(array("page"=>array("gzip"=>true, "minify"=>true)));

  • Mar
  • 2
steve
steve

Leon,

Thanks for putting the time into this. If this works it would be like finding the a winning lottery ticket for me. Unfortunately, so far it doesn't look like it is.

I've been building my first wp theme for the past three months now with very limited coding knowledge, although I have picked up quite a bit, so perhaps I'm missing something.

Anyways, I'm running 2.3.3. I was unable to do the auto install since the test page wasn't working so I tried the manual install. My test site is sitting in mmaconvert.com/testblog on my host's server. After multiple attempts I got the page to work again by using /home/.zag/sbarry/mmaconvert.com/testblog as path for your options. (/php_speedy/ is amended where applicable). Anyways, the page isn't loadiing any quicker and when I check the page source it doesn't appear as if anything is compressed. You can see it here.

I did move as many of the plugins js files as i could into wp-includes/js attempting to get this to work, so I don't know if that makes a difference or not.

Any ideas? thanks

  • Mar
  • 3
Vikas Rana
Vikas Rana

when i write this function in top
error occurs:
Fatal error: Call to undefined function get_header() in index.php

  • Mar
  • 3
Josef Heinrich ALTENBUCHNER
Josef Heinrich ALTENBUCHNER

Feeling more and more stupid here. Simply cannot get it to function properly. Anybody with experience integrating php-speedy into a php-nuke CMS?

  • Mar
  • 4
Jen
Jen

I tried to install it in a Wrodpres 2.3 environment. I did not actually try it on my WP install because my testpage didn't work. The cmp files were created, but the js and css wasn't working.

  • Mar
  • 4
Josef
Josef

The testpage that comes with php-speedy seems to produce the expected result. But I simply cannot get things to work on my php-nuke CMS when trying to integrate

require("php_speedy/php_speedy.php");

into any of the php-files I think it could work with (mainfile.php, index.php, header.php) ... nothing seems to work.

help would be highly appreciated ! thanks in advance !

  • Mar
  • 4
Josef
Josef

when trying to use David C's code:
require("php_speedy/php_speedy.php");
$compressor = new compressor(array("page"=>array("gzip"=>true, "minify"=>true)));

I am getting this same error:
Fatal error: Call to a member function set_paths() on a non-object in /public/php_speedy/controller/compressor.php on line 38

and yes, the libs/php/view.php file IS present !

  • Mar
  • 4
steve
steve

Same thing happened to me as Jen when I tried the auto install if that gives any clues to my posting from earlier.

  • Mar
  • 4
Jeromy
Jeromy

Getting the same error as Josef - running wp 2.3.3, no other caching/optimizing tricks happening

  • Mar
  • 4
admin
Leon

David C - the errors are because it can't find any scripts. Add some in to your test page and see what happens. (The latest version of Speedy - coming soon - handles this more gracefully). Also, you way you are calling Speedy is outdated. Please try the latest version, and the final page of the install shows you how to call Speedy.

Steve - No, it definitely not doing anything on your test blog. I've uploaded a preview release of a Wordpress plugin for PHP Speedy. It's not 100% finished, but I have it working accross so please give it a shot and let me know how you get on: http://aciddrop.com/aciddrop/download/php_speedy_wp-preview_release.zip

Vikas - try the preview Wordpress plugin: http://aciddrop.com/aciddrop/download/php_speedy_wp-preview_release.zip

Jen - try turning off Gzip compression. If not, look in the source and examine the HEAD. Are the CSS and JS files linked to correctly?

Josef - I had a look at php-nuke for you. The code uses ob_end_flush() and ob_end_clean() extensively, which is not compatible with PHP Speedy I'm afraid.

Jermony - try the preview WP plugin! http://aciddrop.com/aciddrop/download/php_speedy_wp-preview_release.zip

  • Mar
  • 5
steve
steve

Leon,

I got mixed results. The good news is that atleast some is working. The bad news is the expires feature isn't working. Also, on the test configuration, it keeps saying there is not any javascript or css in in my site, but it still found some it and compressed it after activating. I did try this on the default theme with no plugins and the test config screen did show what I would expect to be correct results.

The Y-slow results improved from a 21 to a 51 but still an F. I posted before and after screenshots of Y-slow on my test blog if you don't mind taking a look.

Two other things. It did break two of my plugins. The minify page option turned on broke the AjaxedWordpress plugin - Inline post feature. Also, the minify javascript, gzip javascript, and far_futures expires javascript all broke the event calendar plugin even if each was turned on by themselves. Is there anyway you can take a look at those issues? I don't think I can part with those. Hopefully its just because you aren't done.

One other question. I mentioned previously i moved a bunch of the plugin's js files into the wp-includes/js folder. Should I move these back or would it matter?

thanks

  • Mar
  • 5
admin
Leon

Steve - many thanks for the feedback, much appreciated. Would you perhaps be able to provide me with a login for your test blog (that has access to the plugins) so I can go in and have a look myself? My email is leon@aciddrop.com.

  • Mar
  • 5
steve
steve

Email's sent leon

  • Mar
  • 5
Jeromy
Jeromy

wow, it worked great man! I went from a rating of 50 to 63. FYI, some plugins containg js file like this: "js.php" or simply being served right from a php file. PHP Speedy does not gzip or minify those (can it??). Otherwise, it worked perfect!

  • Mar
  • 5
Jeromy
Jeromy

well, so far it's conflicting with this plugin:

http://ajax-comments.dev.rain.hu/

Totally disables it. I'm also getting errors from this plugin:

http://aboutme.lmbbox.com/lmbbox-plugins/lmbbox-comment-quicktags/

in firebug, though it still appears to work. It would be nice (at least for the moment) to exclude certain files from the process.

  • Mar
  • 5
PJ
PJ

I got this error wehne trying to activate the wordpress plugin.

Plugin could not be activated because it triggered a fatal error.

Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/thinktec/public_html/wp-content/plugins/php_speedy_wp/libs/php_speedy/libs/php/jsmin.php on line 49

  • Mar
  • 6
filex

Plugin wordpress error:

Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/blogedit/public_html/wp-content/plugins/php_speedy_wp/libs/php_speedy/libs/php/jsmin.php on line 49

  • Mar
  • 7
admin
Leon

Steve, Jeromy, PJ, Filex - I have a new version which should fix your issues.

Jermony - at the moment it ignores JS with a .php ending. This is because it takes the file contents directly from the server.

New version here: http://aciddrop.com/2008/03/07/php-speedy-wordpress-plugin-preview-release/

  • Mar
  • 8
ramiroei
ramiroei

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\x1c\php_speedy\controller\compressor.php on line 556

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\x1c\php_speedy\controller\compressor.php on line 563

Warning: implode() [function.implode]: Bad arguments. in C:\AppServ\www\x1c\php_speedy\controller\compressor.php on line 344

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\x1c\php_speedy\controller\compressor.php on line 556

Warning: Invalid argument supplied for foreach() in C:\AppServ\www\x1c\php_speedy\controller\compressor.php on line 563

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\x1c\php_speedy\controller\compressor.php:556) in C:\AppServ\www\x1c\php_speedy\controller\compressor.php on line 315
‹x^í]YsG’~6#øJp mÏGãâ!˜‡D™×ˆ”vç Ñ@7¦]p”¨™yœº?`Ÿöì—ÕWU HIKaDwYYY (and symbols go on...)

  • Mar
  • 12
Vinicius Eduardo

Hi,

Doing a research about site optimizing, i found a PHP Speedy. So, I've done some tests, but it dosen't work in Internet Explorer(IE). Only in Firefox. It gives us an error 404.

What can be the cause of this error? Is it only works in Firefox?
How can I fix it?

Thank you a lot...

Vinicius

Link:
http://qa.videolog.tv

  • Mar
  • 12
admin
Leon

ramiroei - make sure you actually have some JavaScript or CSS in the head of your document.

Vinicius - what so you mean by "doesn't work?". Try turning off the options one by one to see if you can locate the problem.

(I'm now away until Monday 17th Mar)

  • Mar
  • 14
Adriano Gonçalves

Hi,
Mainly, congratulations for your great work. That idea is very good and useful, thank you to share it!

I'm with a problem when my page isn't in Apache's root directory:

Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/********/httpdocs/php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/********/httpdocs/php_speedy/controller/compressor.php on line 563

Warning: implode() [function.implode]: Bad arguments. in /home/httpd/vhosts/********/httpdocs/php_speedy/controller/compressor.php on line 344

Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/********/httpdocs/php_speedy/controller/compressor.php on line 556

Warning: Invalid argument supplied for foreach() in /home/httpd/vhosts/********/httpdocs/php_speedy/controller/compressor.php on line 563

Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/********/httpdocs/php_speedy/controller/compressor.php:556) in /home/httpd/vhosts/********/httpdocs/php_speedy/controller/compressor.php on line 315

After this, the page shows several strange characters. In this case, my page is in directory "/economia/", and php_speedy is in "/php_speedy/".

Best wishes,

Adriano

  • Mar
  • 19
hussan

hello, i use joomla extension and publish it, but the includes of css and js dont generate and not included in my page:

http://www.lojasnoparaguai.com.br/?speedy=1

tanks

  • Mar
  • 20
David
David

For those trying to use Speedy on Joomla sites, Fiji web design have developed a pluging for Joomla 1.0.x sites. You can find it here:

http://www.fijiwebdesign.com/downloads/task,doc_details/gid,36/

  • Mar
  • 22
louis w
louis w

Can you tell me what the $compress_options['minify']['page'] option does? Should it condense the html output of the page? I have this on and it doesn't appear to be doing anything.

  • Mar
  • 22
visitor
visitor

reduces whitespace at the beginning of a line, as far as i can see.

  • Mar
  • 24
shovi

Is it possible in any way that this script couses problems with seargh engines or affects in my Google ranks?

  • Mar
  • 25
Babak Fakhamzadeh

Looks like a superduper script, BUT.

My php-speedy test page works fine, but trying to speed up a page in my site results in 2 of the 3 CSS files stored in the cache folder not existing.

See this in action here:
http://healthdev.net/site/index_speedy.php

  • Mar
  • 25
Babak Fakhamzadeh

Sorry for posting twice.

You can find the same page, sans speedy here:
http://healthdev.net/site/

  • Mar
  • 26
Jeromy
Jeromy

New problem Leon - submitting any form on my site (whether with the cforms plugin or another basic form) gives this error:

Fatal error: Call to undefined function is_comment_feed() in /path/to/site/wp-content/plugins/php_speedy_wp/php_speedy_wp.php on line 495

  • Mar
  • 26
admin
Leon

Jeromy - thanks. Should be fixed in 0.4.3

  • Mar
  • 26
admin
Leon

louis - it will remove all leading spaces, tabs and carriage returns

  • Mar
  • 26
Jeromy
Jeromy

I upgraded to the newest one, same problem - sorry man!

  • Mar
  • 26
admin
Leon

Jeromy - same error message? Are you sure you upgraded completely, because the is_comment_feed() function isn't used anywhere in the code at all any more.

  • Mar
  • 27
Giancarlo Di Massa

I'm trying php speedy with php 4 and it produces a notice, because the $jsmin variable is not instantiated, I changed line 71 of php_speedy.php from

'jsmin'=>$jsmin

to

'jsmin'=>(isset($jsmin)?$jsmin:null)

  • Mar
  • 28
Will Sokolowski

can somebody please help me? I haven't got a clue how to get this installed on my site, and my site is taking forever to load. Could someone please contact me at submit@thewanderlustway.com? I really need some help. Thanks!

  • Mar
  • 30
Kaspars

Leon, just wanted to let you know that it works perfectly with WordPress 2.5 which was released a few hours ago. Thank you so much for the plugin!

  • Apr
  • 3
admin
Leon

Giancarlo - thanks. I'll look into making that change for the next version.

Will - looks like you're running a Wordpress blog. Have you tired the PHP Speedy Wordpress plugin? It's pretty easy to install.

Kaspars - thanks!

  • Apr
  • 4
LOOKUP
LOOKUP

IT'S A GOOD SCRIPT I THINK THAT IS GOOOOOOD

  • Apr
  • 6
stylephreak

IE seems to have a problem (will not load page) when minify page and/or gzip page are set to true (1). Anyone else experiencing this problem?

  • Apr
  • 7
admin
Leon

stylephreak - I haven't seen that happen. Is your source for IE any different for that of other browsers i.e do you have some IE specific code? A blank page can happen if there's a PHP error and gzipping is on.

  • Apr
  • 7
admin
Leon

- Sorry for the late replies here, your comments got lost in moderation -
--------------------------------------------------------------------------
Adriano - it looks like speedy isn't able to find the scripts. If it looks like a path problem, did you try changing the value for document_root in the config?
shovi - no
Babak - Looks like the problem may be the space in the media="screen, projection, print" declaration for your styles. I'll look into it, but for the time being just try removing the space.

  • Apr
  • 8
Gazza_Dude_UK
Gazza_Dude_UK

Hi Leon,

Would I be able to use php_speedy with CS-Cart which is an ecommerce shopping cart?

Its written in PHP but I also have SEO enabled to show the pages as HTML.

  • Apr
  • 9
Babak Fakhamzadeh

Thanks Leon, for the reply.

No real luck, yet, though:
http://healthdev.net/site/index_speedy.php

I took out the space between the 'screen' and 'projection', etc. But with minify turned on (and gzip and expiration turned off), the page still doesn't load properly.

Bummer.

  • Apr
  • 9
Giancarlo Di Massa

The script throws errors if a page in a site doesn't contain any CSS or JS files, it wants to loop trough empty arrays, look at the compressor.php file where it says

foreach($script_array AS $key=>$value)

I suggest inserting a check that skips the compression procedure if the $script_array variable is not populated.

  • Apr
  • 12
monchester

I follow the instructions, upload to my xoops folder add the suggested code to the index.php and it works!

Actually reduce the http requests from 83 to just 22 and the load time in almost 40 seconds.
I just have a minor problem considering the speed improvement, and is that my slideshow using the imagerotator doesn´t work as before :

SWFObject is not a constructor
http://tunaseiners.com/online/
Line 64

Beside that is a very good script..!
Thanks for sharing

  • Apr
  • 15
Yahweh
Yahweh

Hi ;)

I wonder if you can help me.

I'm using a general wizard based website creator, but the problem is that I can't get php speedy to work properly.

I would like to enable php speedy to speed up my site, but I'm not sure where to add the code?

I have installed php speedy, but when I add the code to a normal html file it doesn't work.

Can you give me a short step by step to add php speedy code to a normal html file, without having a .php site? Is this possible?

My html basically looks like this:

I removed the content out of the HTML file, but that is basically the Index page which loads before the home page.

Any help would be appreciated ;)

Thanks,
Yahweh

  • Apr
  • 16
Luis Eduardo

Hi Leon,

I made little changes in php_speedy, where i send this changes?

  • Apr
  • 20
Carlo Veltri

GOOD

  • Apr
  • 23
Abhay

‹x^µVmoÛ6þœùWm˜̲ÞüžXÅævK‡¶ o]?´x²ØJ¢FÒv²¢ÿ}'ÊqÜ4 Ú¡3 ˆ¢xϽ?¼³GO~ŸÎÞ\{ñ‚Ž3ÅJ-Œ%Ë=ïéKœÌ˜jìy›Í¦³‰:R-½Ù+ïªÆ jáíÒ5{’n¸žYWE^êÉ=8Áh4jÄ›ÃÈx-T ad«©\ü{%Ög*Kƒ¥qg×:4oÇà•ñj §dLi4¡¥;öFnà€WcarŒ§²¨j /f¨Í™×ìӝ(Q0½E|ËÖ¬Ùu@«dgx.–gR¯Êª¹®ùµ÷V',ÉЛ'E5¿•œ')ÂQw… ?J†l˜„A7ìù~·;Š:„áÄg^£(†[K¬J““s#WI6/ÐÃ5*+ñ;ËR*¬A¿Õ_&Ÿ‹òݾ¢D“`¦0}8tl/ô¦ÍuŽ:C4ó(eiw菐ECztGÜg£E°£nÐôšp€Â|âÜJmSøíÍ©” 覜w‹”õûƒ0 6û,ìaÚí ÜÇ&àŸØT lâXŒol!Ë ª’ÌXÉ3Ìù|„ý0YôƒÀïû}>Ji8@¦Ñ(IƒA°oãN؁­‰7(ÿ—•M{)Ã^,¥Ü_ôRì%È)”©¿ÆOM܏¢Müݺ«{ø‘ë.$¿†÷Ô'u×»,§º瘚ӣÔzÅMY!òëñŸ¨8+Y~R‚åm8Ç|F$´£‰Ù\J¤$S0µ¥[#Œ¿º¢­G‡YÐÎÂvÁûQE¢=AÎL¨á%nà•,Xé´ÁîúÇÀ iŒ,ö ]·vųNÚU¶e»Ú1K•A|.7`$XjU×r¥`ƒ "d$ >VųLh ?CT["¤JpF¬¹ß¥,œ+YuYÔœå6œåÄçpiùëÌcÄ•ÕÆÏ4˜ á7"Àˆµy©Þ‰rù˜líÑ(¾4T¢Lq8—JüC `9\æ‚£¢C‘å3.Ö 8‘ªbÉ;âcëúÄÙn²qè×A‡}Z*¹*¹›È\ªñwI’œB†b™mc¯†¬º¤s¼ f¸êÝœú>Ý+¥IK!×xZÓ/áÚdlŸ•5˜ãbµ œø‡r¡«Ó:¶Þ}ËÈ9ªßÌ8ñny÷L)©hщ›çݯ kèŠÝ.è×Øù:c† GQ;Q>›zZ2Qê] «øø¥4Íw[Fö4Ý: LéÆÆ9å¼Ð¢ *Ó'·±ˆš2´Å·&ƒ_„ªÃÖ¾§š³W.M¶"È0Q,› uUÞ|EÞYŠÔb†‰³…¸¡f°Æ·Ïëe)‘' ŸWû_”6Õn[îÖ×7:—›¯öt~]‹}¹¿©þg¿VoSEÞ /=< å¬\®¨&ÎÞØDÉö´-”À—_AÓ$ç;ºNNëÖº×êe=xÆÿ\€òT\

Getting above code in test page of php speedy..
Please help me on this

  • Apr
  • 23
Yang

eTags and expire header aren't optimized on my blog using phpspeedy,could you tell me how to optimize these?Could phpspeedy automatically optimize these for me?

  • Apr
  • 24
Abhay

‹x^µVmoÛ6þœù

Getting above code in test page of php speedy..
Please help me on this

  • May
  • 2
mark

Will this work well with smarty templates?

  • May
  • 2
Łukasz Czerwiński

I didn't found this problem mentioned here, so I will write a few words:

I've installed PHP Speedy on the server and when I opened a test page everything seemed to be OK, but the webpage wasn't compressed! I have found why:
In my root directory I have my own config.php file with some configuration for my website.
Calling:
require("config.php");
from php_speedy.php included MY config.php from root, not php_speedy/config.php.

Solution:
Configuration file should have a name which is unique, e.g. config_speedy.php
If you change it manually, you have just to rename config.php to config_speedy.php and change line no. 113 from php_speedy.php to: require("config_speedy.php");

Apart from that - IT'S A GREAT SCRIPT :)

  • May
  • 3
Elbert

It works for my site with smarty templates and eaccelerator. it speeds up downloading of pages but seems to have a longer delay (latency) before it starts displaying the page.

  • May
  • 6
hemant vijay

I installed for my pligg site. I get this error (only for home page):
Could not open ./
What am I doing wrong?

  • May
  • 9
David
David

It's awesome when it's not breaking TinyMCE =X

Maybe future you could add a way "exempt" chosen files from being compressed.

  • May
  • 16
Sebastian
Sebastian

yes, it will. i've tested it, and it works very well.

my personal problem is, that the tinymce will not be cached. has the .js files to be included between the html-head, or can i put them wherever i want to?

  • May
  • 20
admin
Leon

Gazza_Dude_UK - yes, it should work.

Babak - I still see spaces there. E.g

CODE:
<link rel="stylesheet" type="text/css" href="css/paginator.css" media="screen, projection, print" />

Giancarlo - thanks

Monchester - I'm not sure, but it may be because you are missing a space in your include of swfobject:

CODE:
<script src="http://tunaseiners.com/online/themes/round/swfobject.js"type="text/javascript"></script>

There should be space before type.

Yahweh - I'm afraid you need PHP for PHP Speedy. You can't use it on just an HTML file. (That's why it's called PHP Speedy ;-)

Luis - to leon@aciddrop.com, thanks.

Carlo - good!

Abhay - try turning off Gzip compresssion.

Yang - no PHP Speedy doesn't handle these. You can use Apache, should be quite easy to Google for.

mark - yes, I use it with smarty on this blog infact.

Łukasz - interesting problem, thanks for letting me know.

Elbert - I have timed it, and the extra latency is very small. If you use caching with smarty you can remove it completely.

hemant - I'm afraid I haven't tried it on pligg. Did you manage to fix it?

David - you can except certain files. This is easily done in the Wordpress plugin version. In the standard version you can do it too. Just set $compressor->ignore('file1.js','file2.js') after the require('pathtospeedy/php_speedy.php') line.

Sebastian - yes, the JS has to be in the HEAD

  • May
  • 20
Charles
Charles

Leon-

Awesome! I was about to build this out of necessity, and you've already done so. Thank you!

There is a parse problem with concatenating javascripts loaded with arguments; the arguments are translated into illegal characters prior to the JS inclusion in the cached JS.

Example:

Results in having these added before the JS:



I don't even know if this could correctly parse javascripts with arguments, and protosafe is a bad example anyway since it sends out ajax requests later (which defeats the purpose here), but the illegal chars break the rest of the JS in the page.

Just thought I'd point it out since I didn't see anything else about it.

Charles

  • May
  • 26
B.Mossavari
B.Mossavari

As Łukasz mention before , It would be better to rename Config.php ,
In my test bed (XAMPP on WinXP) default include path is ".;C:\Program Files\xampp\php\pear\" and this made some issue cause there is a config.php in "C:\Program Files\xampp\php\pear" that loads instead of php_speedy ones
BTW it's very handy script
Cheers

  • May
  • 28
Charles
Charles

If you are having trouble getting PHP Speedy to work with your code, here is a summary of the things I found I had to do to have PHP Speedy working well with my code:

1. If you have any in-page javascript in the section, all the javascript will break. Move it either into a separate js file loaded in the same spot or move it to after the beginning of the tag.

2. Relative CSS URL links (for background images, for example) become malformed. Change all URL relative links in CSS to absolute references. (if you turn on php speedy and your backgrounds disappear, this will fix it)

3. You can't use javascripts generated by PHP. Find another way (one workaround - change it to inline javascript code after the tag).

4. If you have javascripts that you can call with arguments (like protosafe, for example), you can't use them. Find another way.

The benefits:

Page load (min/avg/max): From (4/9/12) seconds to (.4/.8/3) seconds.
Page size: From 440k to 398k.

  • May
  • 31
Nick Bostic

Okay, tried FTP/web page install on Wordpress 2.5.1 site (www.retechcoach.com). The only option I could choose was "Minify page", every other choice either messed with CSS or caused the page not to load when tested on a variety of browsers. Not always the same behavior with each.

I tried the WP preview plugin and get this error:
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/retech/public_html/blog/wp-content/plugins/php_speedy_wp/libs/php_speedy/libs/php/jsmin.php on line 49

I would really love to use your utility to speed up my site. Any suggestions?

  • Jun
  • 2
Anatoly
Anatoly

Hell can you guys please tell me if i want to use PHP Speedy on more then one page do i have to install it like twice? or just edit the php code to all the pages? please help.

  • Jun
  • 3
visu.veluri

I am using select box wrapper scripts and bubble tooltip on the same page. all the scripts are getting joined and causing me errors like jquery not loaded.
Is there any way of forming separate compressed jscript files..?

  • Jun
  • 5
Babak Fakhamzadeh

Hi,

It seems I figured the issue with my installation of PHPspeedy not working.

The problem was not the space in the CSS declaration (i.e. media="screen, projection") but the comma. Taking out the comma does make speedy work.

Indeed, that means that I need to declare the same CSS files for multiple media.

  • Jun
  • 5
admin
Leon

Nick - It's tough to help you without some more information. Please see this page http://aciddrop.com/2008/03/22/php-speedy-wordpress-plugin-version-04/ and "If PHP Speedy breaks something else".

Anatoly - you just need to edit the PHP code on the pages you would like to use PHP Speedy on. This is made easier if you have one file that serves every page in your site.

Visu - try playing with $compressor->ignore('file1.js','file2.js') after the require('pathtospeedy/php_speedy.php') line. Ignore the scripts that are causing problems.

Babak - You're right. This is an issue with the standalone version of PHP Speedy. I suggest you download the Wordpress version (0.4.6) and use that instead. You can use it even if you don't have Wordpress - have a look at the "compress_me.php" file in /libs/php_speedy/test_page to see how.

  • Jun
  • 5
Anatoly
Anatoly

Hello Leon This is Anatoly i am trying to use PHP Speedy on my PHP site its not blog its just php and it works good but only on one page ... How do i setup php speedy for all pages so it will not made a cross error? or something? but it works great on one page!!!

  • Jun
  • 5
Anatoly
Anatoly

Hey Leon can you please email me? or give me your email?

  • Jun
  • 6
Ryan Thrash

It might be beneficial to mention how PHP Speedy is licensed in the description above; for those that are curious, it's GPL 2.1 (or later). Great stuff, btw!

  • Jun
  • 7
laurent lauden
laurent lauden

In drupal, it's perfect for js but nothing is done for css.
I think that it's because of the @import. Drupal, for including css use multiple tags like :
@import "/modules/book/book.css";

  • Dec
  • 18
jun
jun

Hi Leon, I have the same question as kaydubbleu. I have multiple pages on my site, each time a different page is accessed, the cache content is regenerated (it gets a cpu spike). How can I make this to generate one cache entry per page? Thanks.

  • Dec
  • 18
jun
jun

Re my earlier question re: the multiple pages. I found a solution by appending the .$_SERVER['REQUEST_URI'] to the cachedir variables and it works for me.

  • Dec
  • 18
Barbara Woolums
Barbara Woolums

I just installed PHP Speedy and it works great in IE and Firefox, great improvement - thanks. It doesn't seem to have any effect in Maxthon (may favourite browser). any ideas?

Comments are closed