Migrating mod_php7 to php-fpm

I actually struggled a bit today to find what I needed. There was a decent start with SDB:Apache FastCGI and PHP-FPM configuration, but missed a few things.
If you're migrating, you can have both worker and prefork installed, just edit the APACHE_MPM variable name to switch. Same with having 'php7' in/out APACHE_MODULES.
Above article was incomplete, more Googling showed:
<FilesMatch "\.(php|customext)$">
SetHandler "proxy:fcgi://"
<Proxy fcgi://>
ProxySet connectiontimeout=30 timeout=21600
RewriteCond %{REQUEST_FILENAME} \.(php|customext)$
RewriteRule (.*) - [H=text/html]
Can just rename this so it doesn't load when testing fcgi.
If you're migrating, you can copy the /etc/php7/apache2/php.ini to /etc/php7/fpm/php.ini otherwise you can strike problems (such as browscap missing ini location, etc).
If you're using vhosts, or custom php extensions, you should add to your VirtualHost
<Files ~ "\.(php|customext?)$">
SetHandler "proxy:fcgi://"
If you're using custom extensions, and have the parameter security.limit_extensions enabled in your pool config, you should add the extension there.

I'd only remove apache2-mod_php7 after all the above is working. If you don't remove it, it can add the apache2/conf.d/ referennce again during package updates, which you don't want.


Sign In or Register to comment.