[arch-dev-public] Moving from fcgid+php-cgi to fastcgi+php-fpm

Pierre Schmitz pierre at archlinux.de
Mon Dec 13 10:23:31 EST 2010


I'd like to switch our current PHP setup on gudrun to use php-fpm. This
also means switching back from fcgid to mod_fastcgi as that is missing
something like FastCGIExternalServer; see

PHP-FPM is a process manager that comes with PHP since 5.3.3. The
benefits are:
* independent of the webserver. (restart apache or php without
interfering the other)
* graceful reload of php without loosing requests
* APC will work more efficient as the cache is shared. (atm each
process has its own cache which also breaks FluxBB somehow)
* It can manage different pools dynamically run by different users and
* hopefully simpler server setup

Each apache vhost needs to be pointed to its corresponding php pool
like this:

FastCGIExternalServer /srv/http/php-fpm -socket
AddHandler application/x-httpd-php .php
Action application/x-httpd-php /php-fpm

A pool configuration could look like this:

listen = /var/run/php-fpm/$pool-fpm.sock
listen.owner = http
listen.group = http
listen.mode = 0660
user = php-$pool
group = php-$pool
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 800
php_admin_value[open_basedir] =
php_admin_value[session.save_path] =
php_admin_value[upload_tmp_dir] =

Any ideas or objections? (Maybe some day I also get the chroot feature



Pierre Schmitz, https://users.archlinux.de/~pierre

More information about the arch-dev-public mailing list