# Migrating mod\_php7 to php-fpm

**URL:** <https://forums.suse.com/t/migrating-mod-php7-to-php-fpm/35339>\
**Category:** General Discussion\
**Created:** [October 25, 2020, 6:51am UTC](https://forums.suse.com/t/migrating-mod-php7-to-php-fpm/35339 "2020-10-25T06:51:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rehtael](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@Rehtael](https://forums.suse.com/u/Rehtael)\
**Post date:** [October 25, 2020, 6:51am UTC](https://forums.suse.com/t/migrating-mod-php7-to-php-fpm/35339/1 "2020-10-25T06:51:53Z")

</div>

I actually struggled a bit today to find what I needed. There was a decent start with [SDB:Apache FastCGI and PHP-FPM configuration](https://en.opensuse.org/SDB:Apache_FastCGI_and_PHP-FPM_configuration "SDB:Apache FastCGI and PHP-FPM configuration"), but missed a few things.  
**/etc/sysconfig/apache2**  
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.  
**mod\_fcgi.conf**  
Above article was incomplete, more Googling showed:  
`	<FilesMatch "\\.(php|customext)$">`  
` SetHandler "proxy:fcgi://127.0.0.1:9000/"`  
`	</FilesMatch>`  
`	<Proxy fcgi://127.0.0.1:9000>`  
` ProxySet connectiontimeout=30 timeout=21600`  
`	</Proxy>`  
`	RewriteCond %{REQUEST_FILENAME} \\.(php|customext)$`  
`	RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f`  
`	RewriteRule (.*) - [H=text/html]`  
**php7.conf**  
Can just rename this so it doesn’t load when testing fcgi.  
**php.ini:**  
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).  
**vhosts.d:**  
If you’re using vhosts, or custom php extensions, you should add to your VirtualHost  
`<Files ~ "\\.(php|customext?)$">`  
`	SetHandler "proxy:fcgi://127.0.0.1:9000/"`  
`</Files>`  
**php-fpm.d:**  
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.

HTH
