I'm trying to run the mod_pagespeed on a server using php scripts but
only works with static html. As I can make it work with php files?
Hi,
I’m also new to using mod_pagespeed and I’m trying to get it to work with my PHP site. I tried Shawn’s example below and it worked exactly as he said it should (so it is installed on my server correctly).
I’m testing it against my index.php and while it is ‘optimizing’ it, I’m actually seeing only a marginally better performance and I’m not sure why that’s happening.
BEFORE
90 objects 720 KB 5.43s
AFTER
91 objects 677 KB 5.38s
BEFORE
Tested from Dallas, Texas, USA on December 1 at 08:12:32
Perf. Grade 81/100
Requests 88
Page size 774.5kB
Load time 1.98s
AFTER
Tested from Dallas, Texas, USA on December 1 at 07:40:49
Perf. Grade 81/100
Requests 89
Page size 746.2kB
Load time 2.63s
Sure. I’ve set it up on a test site - http://www.lildevelops.com/ - but it is temporarily disabled. Do you want me to re-enable it?
Kinda crazy – but I switched it on about an hour back and restarted apache, but I only see it working on the subdomains, but not the main www one! See: http://test1.lildevelops.com/
I guess the problem is different from what I initially thought it was – mod_pagespeed is working fine on the subdomains (and being effective), but not all on the main www domain.
Do you have any idea why that might be happening?
Hi Naomi,
Thanks for replying. I’ve attached my pagespeed.conf file.
tail -f /var/log/httpd/error_log shows unrelated errors:
[Thu Dec 01 20:32:23 2011] [error] [client 59.178.163.42] File does not exist: /var/www/html/beta/video_files/intro/splash_519947884_Desert.jpg, referer: http://www.lildevelops.com/
[Thu Dec 01 20:32:30 2011] [error] [client 59.178.163.42] File does not exist: /var/www/html/beta/video_files/intro/splash_519947884_Desert.jpg, referer: http://www.lildevelops.com/
[Thu Dec 01 20:32:32 2011] [error] [client 59.178.163.42] File does not exist: /var/www/html/beta/video_files/intro/overlay_655776117_Chrysanthemum.jpg, referer: http://www.lildevelops.com/
Note that the www.lildevelops.com application is located in /var/www/html/beta/ (and it doesn’t work)
And the others (on which pagespeed works) are located in /home/<name>/public_html/
>>> Do you have any ModPagespeed directives in the <VirtualHost> sections?
No – not at all.
>>> If you can send me your entire log (or at least a large section including mod_pagespeed messages) that might help.
There are some error messages being generated which look like this:
[Tue Dec 06 06:37:55 2011] [error] [mod_pagespeed 0.9.18.7-900 @28011] /var/www/mod_pagespeed/cache/sX0sHMkrUWR7DPcapcOS.lock:0: failed to stat (code=2 No such file or directory)
[Tue Dec 06 07:51:03 2011] [error] [mod_pagespeed 0.9.18.7-900 @10158] /var/www/mod_pagespeed/cache/EvSIAgJja7fj9j2G1K7t.lock:0: failed to stat (code=2 No such file or directory)
All of them are similar – the only change in all these lines is the datetime, the number after the @, and the filename.lock.
Viewing it in context of the surrounding lines, I think its happening because of an unrelated issue in our mod_rewrite rules wherein files are being searched for in folders which do not exist.
...
[Tue Dec 06 06:37:52 2011] [error] [client 50.22.133.58] File does not exist: /home/test1/public_html/codelibrary/css/indicator.gif
[Tue Dec 06 06:37:55 2011] [error] [mod_pagespeed 0.9.18.7-900 @28011] /var/www/mod_pagespeed/cache/sX0sHMkrUWR7DPcapcOS.lock:0: failed to stat (code=2 No such file or directory)
[Tue Dec 06 06:40:40 2011] [error] [client 66.249.71.19] PHP Notice: A session had already been started - ignoring session_start() in /home/test1/public_html/codelibrary/inc/config.php on line 14
[Tue Dec 06 06:43:29 2011] [error] [client 66.249.71.19] PHP Notice: A session had already been started - ignoring session_start() in /home/test1/public_html/codelibrary/inc/config.php on line 14
[Tue Dec 06 06:46:18 2011] [error] [client 50.22.133.58] File does not exist: /home/test1/public_html/codelibrary/css/indicator.gif
...
[Tue Dec 06 07:51:01 2011] [error] [client 50.22.133.58] File does not exist: /home/test1/public_html/codelibrary/images
[Tue Dec 06 07:51:03 2011] [error] [mod_pagespeed 0.9.18.7-900 @10158] /var/www/mod_pagespeed/cache/EvSIAgJja7fj9j2G1K7t.lock:0: failed to stat (code=2 No such file or directory)
[Tue Dec 06 07:53:30 2011] [error] [client 122.180.148.196] File does not exist: /home/design1/public_html/content_files
...
>>> Acutally, just to check, you are running these sites as multiple vhosts on one Apache config, right? Where do you include the pagespeed.conf file? In the main config or in the vhosts themselves? This may just be a vhost configuration issue ... maybe.
Yep – these sites are multiple vhosts within on Apache’s httpd.conf file. I’m not sure how the two are linked – I installed mod_pagespeed and didn’t do anything after that.
I’ll send the httpd.conf file to you directly if you don’t mind.