- Feb
- 04
I have made some more improvements to PHP Speedy - many thanks to everyone who gave me feedback. The improvements are:
- Added in compress method for direct content compression
- Made the gzipping functions more robust
- Added in check for query string in file paths
- Changed name of view class to avoid conflicts
Due to popular demand I have also tested it with Drupal and Joomla, and have instructions on how to get it working with both.
Drupal
- Edit index.php in the root Drupal folder
- Include the PHP Speedy code at the top of the page as normal
- At the bottom of the page change print theme('page', $return); to
print $compressor->compress(theme('page', $return));
I'm not a Drupal user so have only tested on a basic installation - please let me know if this doesn't work for you (preferably with a solution!)
Joomla
- Again, edit index.php in the root Joomla folder
- Include the PHP Speedy code AFTER the first two includes made by Joomla. So it would look something like this:
CODE:require( 'globals.php' );
require_once( 'configuration.php' );
require('/home/your_site/public_html/php_speedy/php_speedy.php'); - At the very bottom of the page add $compressor->finish();
Again, I must add the disclaimer that I've only tested this with a basic installation so any problems please let me know.
You can download the lastest version of PHP Speedy at the dedicated page: PHP Speedy
Don't forget to subscribe to my feed to stay up-to-date.

















Great work!
I've tested it with some Joomla sites which were very slow to load because of some ajax modules published on home page and it really improve load time over 500%!!!
And it's very easy to install
A big thank you to the developer!
This is exciting. Going to be watching for the WordPress plugin. Hopefully, it will play nice with WP Super Cache. Thx.
Hi Leon, I've upgraded PHP Speedy on my site and it stoped working, when I turn on javascript minify it gives this error:
BTW, even with all the options turned off, javascript doesnt work.
Could you please send me PHPS 0.42 wich was working fine for me?
Thanks.
Nevermind, I got it myself. Now it works well again.
I'll be looking for a fix, btw.
RUDE - what was the problem and how did you fix it?
Sorry, I didn't mean that I fixed the current version. I just downloaded again the previous one.
OK RUDE, I understand. I have just updated to 0.4.4, maybe it would work with that. If not, perhaps you could turn on JS far future expries but turn off the JS minification. Then let me know the content of the _cmp_javascript file that is causing the problem... Thanks!
Now, when all the options are set to yes, it gives the exact same error than before. Deactivating js minify doesn't seem to give errors, but js is not working (just like before).
I found something strange at the _cmp_javascript file: After the php tags with the headers, there's this weird line:
«p
Ok, I think your commenting system doesn't like at all the way I right them. Here's de weird line:
«p
Ok maybe I should write you an e-mail (send me one and I'll answer with the issue).
Sorry.
Hi again, Leon.
Do you take requests?
If you're using a tool like mint (http://haveamint.com/), it's important that the mint.js include is left untouched, because that makes sure that the page is tracked properly. So, it'd be great if we could 'whitelist' certain js files, which are left alone by PHP speedy. Something like this, perhaps:
$compress->ignore('mint.js, whatever.js, somecssfile.css');
Tried using with Joomla, but just got a page full of gibberish until I put:
$compressor->finish();
BEFORE
doGzip();
Does it now work with ob_end_clean(), or is this just on Joomla?
RUDE - thanks for emailing that through, it was very useful.
Bob - hello again. I added that in to the latest version for you.E.g
$compressor->ignore('sound.js,builder.js');
Alex - thanks
Ben - if your output is echoed in one place then you can. Say your output is echoed/printed like this:
echo $my_page_content;
then you can use: echo $compressor->compress($my_page_content);
Sorry, but I am still having trouble plugging that component into my web application.
My application resides in http://localhost/myapp/...
Once I plug PHPSpeedy in (manually) as described in the documentation, all CSS and JS is missing. No wonder - when a JS url was:
/myapp/public/javascripts/application.js
before - it is now converted to:
http://localhost//_cmp_cssscreenStylesheet_bb8f4b74ed943e2baf36fab87fd068fa.php
That's outside the application.
I couldn't find any configuration settings to work around this problem.
Mostly I got warnings from fopen & Co. about not being able to write to weird folder combinations like (/myapp).
PS: Coding Style Hint - if opening a resource (file / folder) fails - don't read/write from/to it and don't close it. Makes no sense and produces many unneccessary warnings (supplied argument is not a valid resource).
Hi everybody,
I'm not so expert and I receive this fatal:
Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(application) is not within the allowed path(s): (/var/www/web49/html/:/var/www/web49/phptmp/:/var/www/web49/files/:/var/www/web49/atd/) in /var/www/web49/html/index.php on line 96
The php_speedy dir is located at /var/www/web49/html/php_speedy and I required /var/www/web49/html/php_speedy/php_speedy.php at the top of my controllers (I'm a CI user).
At line 96 there's simply if (is_dir($application_folder))
Some help, please!?
hello there , it seems a very cool script ... i have a website that uses SMF "simple machines forum" , i really really wish if you can tell if it works with it and how .... Should i do the usual steps or is there more modifications to other files needed?? i'm impatiently waiting your response and i'll be happy if you could email me , thanx a lot
And one more thing : what about 4images photo gallery ?? is it supported?
Bret and Davide - I have updated PHP Speedy with some improvements to the path finding. Please try again!
Phoenix - I'm afraid I don't know. Why not try and find out?
Leon, thanks for providing such a great PHP application.
I've just created a Joomla Plugin that installs and configures PHP Speedy.
http://www.fijiwebdesign.com/products/joomla-speedy-plugin.html
The problem I'm having is that at random times, the generated JS file (which contains all embedded and linked JS) turns up as 404. If i explicitly refresh the page (ctr+refresh) it may appear. At other times it doesn't turn up. This happens for the CSS file also but not so often.
To fully integrate into Joomla, I had to register the $compressor->finish() method as the handler for ob_start(). Could this be related?
I don't see any files being written to the CSS and JS cache directories also. Is this normal?
Hi Leon ignore my post on the other blog I did not see the above config change that was needed in the index.php file
I have installed the mambot for joomla bot_speedy0.1alpha4.zip and then gone in to configure the mambot and turned on all the options.
With the integration of Joomla do I need to setup the config.php byhand or is the settings taking from the manbot config ? as I went in and set the paths by hand in the file.
I then went and edited the index.php file
With the above changes when I call my site all I get is a blank page I have looked in firebug and just do not see any thing being returned back to the browser its a little bit strange. So any hints would be good
Hi, I tried phpspeedy on Joomla 1.0.14 and the results where great!
Do you have any plans for a Joomla 1.5.1 plugin?
Ciao
Gabe - well done on the Joomla plugin. It sounds like there may be a problem with the clean-up method do_cleanup(). It could be deleting files it's not supposed to. Try commenting that out and see if the problem goes away. Files should definitely be written to the cache dirs - otherwise you'll be generating them every page load which is ridiculously inefficient!
JamesTrix & Nofuseto - I'm afraid I'm not a Joomla expert. Perhaps Gabe at http://www.fijiwebdesign.com/products/joomla-speedy-plugin.html has some info for you?
Nofuseto and other who have this working could you let me know how you set this up.
I am testing now on a dev install I have removed all components and extra mambots and reset to the default template.
I uploaded the mambot and installed and configured it through the site mambots. I then edited the index.php file with the 2 changes making sure the path was correct. I tested the site and I received a blank page. I then made the changes to config.php and set the correct paths. Checked again and still a blank page.
I can print out a phpinfo() if needed to see if it is server side server is linux and php4 based. I have joomla to show all errors in case a error shows up.
So any ideas guys
Hello. First of all, thanks for this great script! I'm using PHP speedy in my website and everything is going awesome. But, when I try to use Lightbox scripts together, they doesn't work. Do you think they cannot be compressed or something?
If you have any idea, I will be very grateful.
pedro - try running them through JSLint: http://www.jslint.com/
Any plans for Joomla 1.5 Support or tutorial?
I understand that a version for J!1.5 is in the works. In the meantime can anyone clue me in on what code needs to be put in either the root index.php file or the template index.php file? I've made a few unsuccessful attempts. I have the php_speed folder in the root directory and I'm using Rockettheme's HiveMind template. Any feedback would be greatly appreciated!