Lee.org

View notable entries only

Installed PHP_FastCGI

February 10th, 2008 6:58pm. Wordpress

While FastCGI has been running, calls to Wordpress have gone from about 4 seconds to 2 seconds. Calls to Mediawiki have gone from 8 seconds to 5 seconds. :-)

I installed PHP_FastCGI on the blog and the (private) Flaming Lotus Girls wiki. I had tried installing it a year ago but it proved unstable. New instructions were put on the Dreamhost wiki and it’s been running well for the last few days. Here’s how I installed it:

in my root Wordpress folder, I created a file called php5-wrapper.fcgi. In it, I wrote:

#!/bin/sh
export PHP_FCGI_CHILDREN=2
exec /usr/local/dh/cgi-system/php5.cgi

and then set the file to be executable like so

chmod u+x php5-wrapper.fcgi

Then I added the following to the .htaccess file:

AddHandler fastcgi-script fcg fcgi fpl
AddHandler php5-fastcgi .php
Action php5-fastcgi /php5-wrapper.fcgi

Done!

Now 3 PHP sessions stays active, waiting for people to call on my server instead of PHP starting up every time I get a hit. When I run ‘ps aux’, I see the processes just sitting there, waiting. Sometimes there’s up to 6 processes temporarily.

Leave a Comment




Subscribe without commenting