I just spent most of friday and saturday fixing a problem with my web server. For the non tech savvy, most typical web servers are composed of 3 distinct parts that must work together to produce your average dynamic content website:
- The web server itself (Apache in my case): responsible for delivering and presenting the pages aswell as receiving the user inputs.
- The database server (Mysql for example): responsible of storing, retrieving and performing database operations.
- The script engine (PHP ): this vary from language to language, but in essence, it is producing most of the dynamic content on a website.
Those are essentially 3 completely independent pieces of software that are glued together.
Now back to my problem. I am running a multi site setup, which means several websites are running on the same machine, to do this cleanly, I was using an apache module called mpm_itk that allows me to neatly separate each distinct site on its own apache/php instance.
Since about a week we have encountered problems, with instances segfaulting (that’s the technical term for crashing 🙂 ). apparently the problem was due to the php module we where using, it is prone to crash when running in a prefork system like this one.
To overcome this we moved to php_fpm, which runs the php script engine separately from the web server, what’s even better is that we can run several “pools” of it, one for each site, all we have to do is to specify the socket for each site in each virtual host configuration file.