[arch-dev-public] Moving from fcgid+php-cgi to fastcgi+php-fpm
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
On Mon, Dec 13, 2010 at 9:23 AM, Pierre Schmitz <pierre@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
On Mon, 13 Dec 2010 10:00:17 -0600, Dan McGee <dpmcgee@gmail.com> wrote:
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.
Sure, forgot to mention it. I guess I'll start with websvn as its probably the least important site we have. I hope one can use fcgid and fastcgi at the same time and there are no conflicting config values. -- Pierre Schmitz, https://users.archlinux.de/~pierre
On Mon, 13 Dec 2010 17:05:29 +0100, Pierre Schmitz <pierre@archlinux.de> wrote:
On Mon, 13 Dec 2010 10:00:17 -0600, Dan McGee <dpmcgee@gmail.com> wrote:
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.
Sure, forgot to mention it. I guess I'll start with websvn as its probably the least important site we have. I hope one can use fcgid and fastcgi at the same time and there are no conflicting config values.
I just finished moving everything to php-fpm. I have also updated to PHP 5.3.4. Some other etails: * Use /etc/rc.d/php-fpm reload to restart the php processes * config files are in /etc/php/fpm.d * The wrapper scripts in /srv/http/cgi-bin are no longer used * for more see the git logs Let me know if there are any problems. (except websvn; that was already broken when I touched it) We might need to fine tune the number of processes etc.; we'll see. Greetings, Pierre -- Pierre Schmitz, https://users.archlinux.de/~pierre
Am 13.12.2010 16:23, schrieb Pierre Schmitz:
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
The reason we switched from fastcgi to fcgid had something to do with fastcgi's poor process management, don't remember exactly. You might ask Jan why we switched in the first place, but it seems to me that these problems are negated by using php-fpm.
participants (3)
-
Dan McGee
-
Pierre Schmitz
-
Thomas Bächler