Installing the PHP Process Manager

The PHP Process Manager, or php-fpm, is a new FastCGI process manager provided optionally with PHP as of version 5.3.3+ and can greatly improve the performance and flexibility of PHP sites and applications. Php-fpm allows you to run your PHP applications in a process separate from the web server, with the ability to configure multiple application pools. Each application pool can be configured to run as different system users, and with separate PHP and process configurations.

For a fully listing of features php-fpm has to offer, please refer to it's documentation.

Prerequisites

To use php-fpm, PHP will need to be installed/upgrade to version 5.3.3 or higher. As Redhat / CentOS 5 only provide PHP 5.1.6 currently, we'll need to use an updated third party yum repository.

One repository that provides this, the is remi repo, which also require the EPEL repository. Installation of both can be done with the following commands.

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Installation

Php-fpm can now be installed via yum.

yum --enablerepo=remi install php-fpm

If PHP is already installed, this will also upgrade your installation (if installed via yum as well) to PHP 5.3.5.

Starting the php-fpm Process

Now that php-fpm is installed, the application process can be started from it's init service script.

/etc/init.d/php-fpm start

The php-fpm process will now be running with the default pool (configured in /etc/php-fpmd.d/www.conf), which runs on port 9000 as the user 'apache'.

To ensure php-fpm starts at system start, add it's init script to the runlevel with chkconfig.

chkconfig php-fpm on