I recently had to make a capacity planning study for a client of mine for which I've been developing a Symfony application. Despite the hardware/cloud architecture problem, I also tried to optimize application performances from a webserver software point of view (the application is currently hosted on a standard Apache2 server using mod_php5). I dug Google a bit and found some very enthusiastic comments on PHP-FPM, a PHP FastCGI implementation and the NginX web server.
While PHP-FPM has just made it to PHP core in version 5.3.3, the OS version of the linux server we are using, Ubuntu 10.04 LTS, only ships with 5.3.2. Fortunately, Brian Mercer released a PHP-FPM sapi for these particular OS and PHP versions.
So installing PHP and PHP-FPM on Ubuntu Lucid Lynx is as easy as:
$ sudo apt-get install install python-software-properties $ sudo add-apt-repository ppa:brianmercer/php $ sudo apt-get update $ sudo apt-get install php5-cli php5-common php5-mysql php5-suhosin \ php5-gd php5-fpm php5-cgi php-pear php5-memcache php-apc
Of course, feel free to add any supplementary packages you need. To start up the PHP-FPM service, run:
$ sudo service php5-fpm start
As a side note, the service will run on port 9000 by default, but you can tweak this up by editing its configuration file located at
Now, let's install the NginX web server:
$ sudo apt-get install nginx
That's it. Let's create a new site configuration for our Symfony application in a new
As you may have noticed, I'm taking part of the convenient custom variable system of the NginX configuration syntax, so you'll probably just have to adapt the
$symfony_root variables to your project needs.
Enabling the website is achieved with a symbolic link, like this:
$ sudo ln -sf /etc/nginx/sites-available/mywonderfulwebsite.org \ /etc/nginx/sites-enabled/mywonderfulwebsite.org
Last but not least, don't forget to launch the webserver:
$ sudo /etc/init.d/nginx start
I did some benchmarks but unfortunately the hardware configuration being quite different between the old and the new platform, the statistics generated did not make much sense. But the reactivity of the application, and memory footprint is much much better with the new setup (I know, this is not a very scientific statement).