My new development environment, Ubuntu 11.04, contains the php5-fpm package that hasn't been available on 10.04. PHP-FPM is especially important when developing on the LEMP stack which uses Nginx instead of Apache. In this tutorial, you will not build anything from source.

Quick Installation

This is the fastest installation possible using Ubuntu's packages. Everything is automatically configured so that you can skip to Post Installation.

$ sudo apt-get install php5-fpm php-apc

PECL Installation

If you prefer using the PECL package manager for PHP instead, then there's extra configuration required. The PECL installation is preferred for most Linux distributions without the php-apc package shown above.

$ sudo apt-get install php5-fpm php-pear php5-dev

First, we need the additional php-pear and php5-dev are required for PECL.

$ pecl install apc

PECL will handle the installation APC but at the end, you're required to configure php.ini.

$ sudo echo "extension=apc.so" >> /etc/php5/fpm/php.ini

In this case, we're using PHP-FPM, so we're appending the configuration to the PHP-FPM php.ini located at /etc/init.d/php.ini.

Post Installation

Finally, restart PHP-FPM to see changes.

$ sudo /etc/init.d/php5-fpm restart

If you're unsure whether APC is enabled, you can check phpinfo().

Have fun with web development.