I'm trying to figure out what which is the best Apache MPM I can install on my VPS. I saw some benchmarks and MPM Worker seems to perform better than the Prefork one but for some reason everyone seems to be recommending Prefork over Worker for PHP setups.
Is this just because some PHP functions are not thread-safe? Only setlocale()
comes to mind, but I'll be using the same locale on every instance so I don't think that will be a problem. My VPS has little memory and I feel that the worker MPM would be a better match for my needs, however I'm not sure.
Can someone help me make up my mind about this? Thanks!
PS: I've also looked into nginx and lighttpd. nginx seems awesome but I'm trying to avoid compiling from source and I still don't quite understand what php-fpm is for. Regarding lighttpd - it was incredible easy to setup PHP/FCGI with it, but I heard that it has memory leaks. Is this still true?
You should use prefork when using apache + mod_php. The FAQ clearly outlines the reason why:
http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2
nginx + php-fpm is also an excellent way to run php applications. nginx has native support for FastCGI and php-fpm is one of the best ways to run php in a FastCGI environment. See the php documentation here:
http://www.php.net/manual/en/install.fpm.php