• Feb
  • 01

Speeding up your website just became easier

UPDATE: New version available: 0.4.6

New to aciddrop.com? Go directly to the PHP Speedy page for a beginners’ guide

PHP Speedy

Introducing… PHP Speedy!

Following all the feedback on the site speed boost script, I have fixed all the bugs, added the features that were requested and come up with a name. It was confusing calling it alternately “site speed boost script”, “compressor”, “aciddrop compress” etc, so I decided to come up with a new moniker. And then waste a few hours designing a logo, of course ;-) (and it’s supposed to be flames, not a sea creature).

So, PHP Speedy now boasts:

  • An installer. Lots of people were having problems with the paths, so we now have an installer that*should* take care of everything very easily. If you need to change anything you can either just re-run the installer, or change the config.php file directly.
  • Full support for relative image paths in your CSS, in multiple CSS files. Image paths in CSS are now converted to absolute paths, so you no longer have to worry about where to cache the CSS.
  • Added support for different rel types. (rel=”alternative” and rel=”stylesheet” are cached separately)
  • Added support for conditional comments in the HEAD tags (this also fixed the problem of commented out stylesheets)

There are still some requirements:

  • You must specify the type when you include your CSS or JavaScript i.e type=text/css
  • Your site can’t use ob_end_clean(); or anything that retrieves the buffer in its code. This rules out Joomla, for example.
  • You need to put the CSS and JS in the between the <head> and </head> parts of your page.
  • If your JavaScript dynamically loads other JavaScripts they won’t be cached. You should link to each individual script in your <head> tags.

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

For those of you who are upgrading, just create a new directory for PHP Speedy and install it there. At the end of the install you will be given the new code to include the PHP Speedy file.

Please let me know how you get on, and report and bugs or problems via the comment form.

Download

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

Tests and examples

Check out the new PHP Speedy dedicated page

Stay up-to-date

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


Related posts

Posted by admin in php
trackback
 

  • Feb
  • 1
RUDE

Hi man, it's nice to see you improved the script this way, simply awesome.

I got a little problem here, the script is randomly screwing up some background paths from my CSS:

CODE:
#menu ul li.portfolio_li {
    background: transparent url(/rw3/wp-content/themes/my_theme//rw3/wp-content/themes/my_theme//rw3/wp-content/themes/my_theme//rw3/wp-content/themes/my_theme/images/m_portfolio-blog.gif) no-repeat bottom left;
}

I can't find a reason for this, because other background images have a perfect path...

Thanks again for this awesome script.

  • Feb
  • 1
admin
Leon

Hey RUDE, thanks for letting me know. It looks like the path replacement is happening multiple times. I think I know what the fix could be. Bug fix coming...

  • Feb
  • 1
admin
Leon

RUDE - new version with the fix now up. You just need to replace the controller/compressor.php file.

  • Feb
  • 1
RUDE

Speedy as the script ;-)

Thanks Leon.

  • Feb
  • 1
RUDE

It works like a charm now! :-D

  • Feb
  • 1
Bret
Bret

Version 0.4.1 still shows PHP notices (undefined variables and indexes).

Disappointing to see that these (although minor) issues are not taken care of.

  • Feb
  • 1
Carl Combs
Carl Combs

Can't seem to get it to work on a local webserver. I think it has something to do with the pathing set in the config. My webserver is a Windows Server with subfolders under the htdocs directory for each site, so "" wont work. I've tried relative paths but they wont work either.

Also, the shorthand php declarations caused the php documents in the package to output text only for me. Maybe consider using to cover your bases for different configuration.

Awesome project btw...keep it up!

  • Feb
  • 2
Scott

Hi-

I use WordPress 2.3.2 with the Theme Switcher plug-in: http://wordpress.org/extend/plugins/theme-switcher/

I tried PHP Speedy, but I found that when returning to my site's home page, the theme itself would not load.

Any ideas on how to get this to work with the Theme Switcher plug-in?

  • Feb
  • 2
admin
Leon

Bret - now I feel bad :-( I'd completely forgotten about the notices issue. It'll be in the next version.

Carl - if you want to use one PHP SPeedy installation for all the sites, you could do something like this when you include the PHP SPeedy code:

CODE:
require('/home/my_site/public_html/php_speedy/php_speedy.php');
$compressor->options['document_root'] = "/home/my_site/public_html";
$compressor->options['javascript']['cachedir'] = "/home/my_site/public_html/php_speedy/";
$compressor->options['css']['cachedir'] = "/home/my_site/public_html/php_speedy/";

With different directories specified for each installation.

Scott - I'll test it with the Theme Switcher later on today and let you know.

  • Feb
  • 2
DrBigFresh
DrBigFresh

Have you tried this in conjunction with any caching scripts? Wondering if the two get along.

  • 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

DrBigFresh - only with Smarty caching, which it gets on fine with. I'm going to test it with some WP caching systems for the WP plugin.

  • Feb
  • 5
Alex

Hey Leon,

looks like a very cool tool. But it's not working on my website :( . I installed it without any problems. But nothing changed on the loading. It is still loading all js and css files seperately. I'm using wp 2.3. Would be great if you can help. I'm not using any cache plugin, just in the wp-config I have
define('WP_CACHE', true);
define('ENABLE_CACHE', true); // Cache on
define('CACHE_EXPIRATION_TIME', 604800);

But I also tried it with set to false and nothing changed with the load.

I appreciate your help

Alex

  • Feb
  • 6
admin
Leon

Alex - I'm looking into this for the WP Plugin. Subscribe to my RSS feed and I'll update you when the plugin is ready: http://aciddrop.com/feed

  • Feb
  • 6
Claudio

Hi Leon,

I tried, the 'null' string disappeared but now it doesn't work: no cache is used.

I think the problem is a path problem: take a look at the sources of my blog, http://www.claudiobergero.it/blog and you'll notice the script tries to load css and js from an inesistent url (the concatenation of my web URL and the document root)

  • Feb
  • 6
admin
Leon

Claudio - I would take it off your blog for the time being, all I can see there is raw gzipped content. 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

  • Feb
  • 6
Alex

Thank you Leon, looking forward to see a WP Plugin. I subscribed to your feed :)

  • Feb
  • 7
Thibaut Allender

Hi,

You seem to mess up aboslute and relative paths.

config is :

$compress_options['document_root'] = "/home/user/";
$compress_options['javascript_cachedir'] = "/home/user/phpspeedy/";
$compress_options['css_cachedir'] = "/home/user/phpspeedy/";

the resulting page shows paths like :

href="http://domain/home/user/phpspeedy/_cmp_cssstylesheet_8663a80d9ca39e315c66ded7f6549103.php"

I guess it should strip the document_root from the cachedirs but it doesn't ;-)

HTH

  • Feb
  • 12
admin
Leon

Thibaut - thanks, yes. This should now be fixed in 0.4.6!

  • Feb
  • 14
Agung
Agung

i'm upgrading. so i can just delete the previous folder and upload the new one, then re-install and copy the script again, right?

  • Feb
  • 14
admin
Leon

Agung - yes. Comment out the include of PHP Speedy first though. E.g:

CODE:
//require('../php_speedy.php');

Then comment back in once you have installed the new version.

  • Feb
  • 20
MInTheGap

I'm also interested in the WordPress plugin and have subscribed to your feed. Thanks!

  • Jun
  • 8
Lesther
Lesther

Is this avaliable to joomla 1.5.3? Thanks!

Comments are closed