(ve):Install PHP-FPM on Debian 5.0
- This page was last modified on November 22, 2010, at 10:42.
From (mt) Community Wiki
PHP-FPM (PHP FastCGI Process Management) is a patch for PHP to improve PHP’s FastCGI capabilities and administration. The most common option for those using Lighttpd or Nginx is spawn-fcgi, a library from Lighttpd to manage PHP processes. Although this works well in many respects, PHP-FPM offers a few additional benefits over spawn-fcgi:
1. Process Management. Using PHP-FPM provides the ability to gracefully stop and start PHP workers without losing any queries. You also have a log and pid file as well.
2. Restrict IP addresses from which requests can come from.
3. Start the workers with different uid/gid/chroot/environment and different php.ini option. You do not need a safe mode.
Please be aware that chroot/chdir has an unverified bug against it that can cause session errors (multiple sessions) because /dev/urandom is hard code called from a stack ~ which has not been traced out by the PHP team yet ~ this only happens in a CHROOT/CHDIR environment that has adjusted the /dev path of urandom to, for example, /home/%u/data/dev/urandom
There is also another un-verified bug reported against PHP 5.3.3 CHROOT/CHDIR that will not let hardlinks out of the chroot path for executables but will for sockets and will sometimes not even allow the execution of static binaries such as msmtp
4. Just like MySQL, PHP-FPM provides the ability to track the slow execution of scripts and record them in a log file along with the backtrace.
This wiki will provide steps to install PHP 5.3.2 with FPM baked right in. Until PHP starts shipping with FPM, the easiest way of getting this set up is with the dotdeb packages. To get started on Debian 5.0 (Lenny), lets add the new repository:
echo "deb http://php53.dotdeb.org stable all" >> /etc/apt/sources.list
Now, update the package list:
apt-get -y --force-yes update
Continue on and install the PHP modules you need. Keep in mind these are just example modules; you may not need php5-memcache or other modules. For this wiki, you'll only need php5-fpm:
apt-get -y --force-yes install php5-cli php5-common php5-mysql php5-suhosin
apt-get -y --force-yes install php5-fpm php5-cgi php-pear php5-memcache
Using the --force-yes option will allow apt to roll through the authentication warnings. Once the packages are installed, you can start the PHP daemon:
/etc/init.d/php5-fpm start
To check that PHP is listening on port 9000, run the following command:
netstat -ant | grep :9000
You should see something like this:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN