Friday, 20 November 2009

PHP-FPM

I've been looking at the different ways to server PHP files.

Way back when I used CPANEL (hey everyone has to start off somewhere and it does help when the likes of awk and grep scare you), I used apache with mod_suphp or mod_php (depending on what was running, wordpress=mod_suphp)

Now I know what I'm doing (or at least I like to think I do!) I go for nginx, proxying php files back to apache with mod_php (and mod_suphp for Wordpress still...slow..poopy..need better solution).

Now another player comes into the fray, Wordpress and similar systems to update themselves require write access to themselves now if you run mod_php then the "nobody" user needs write access...ack not that wonderful having to chmod everything to 0777.

So in comes mod_suphp which elevates the PHP process to run under the script owners user (assuming it's not owned by root, that could be very bad in a web environment).

Unfortunately mod_suphp is slow.....I'd say at least 4 times slower than mod_php (that's not a real benchmark just a guess).

Looking for a replacement here comes PHP-FPM which is basically a FCGI process manager (the FPM part) for PHP. Looking at it it's promising (hopefully it'll be integrated into PHP 6). It means you can eliminate apache all together and run processes as the script owner.

I haven't tested it but when I get some free time I think I'll defiantly crank up a new server and test it.

If anyone is wondering why I didn't mention PHP and mod_fcgi or mod_fgicd then FYI they're pants! Not too stable, happen to crash and chew up memory and a pain to configure.

0 comments: