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

Dan McGee dpmcgee at gmail.com
Mon Dec 13 11:00:17 EST 2010


On Mon, Dec 13, 2010 at 9:23 AM, Pierre Schmitz <pierre at archlinux.de> wrote:
> 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)

If you don't need to switch it all at once, maybe trial it with bugs
first (being a lower traffic subsite), work out the kinks, and then
roll it out to everything. But otherwise no objections.

-Dan


More information about the arch-dev-public mailing list