[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


Hello,

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
http://httpd.markmail.org/message/pnj6pkxjmulrt3vo?q=php-fpm

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
settings
* hopefully simpler server setup

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

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

A pool configuration could look like this:

[wiki]
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] =
/srv/http/vhosts/$pool.archlinux.de/:/usr/bin/diff3:/usr/bin/diff:/usr/share/file/magic.mgc
php_admin_value[session.save_path] =
/srv/http/vhosts/$pool.archlinux.de/sessions
php_admin_value[upload_tmp_dir] =
/srv/http/vhosts/$pool.archlinux.de/uploads

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

Greetings,

Pierre


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


More information about the arch-dev-public mailing list