The wikis are now using the new authentication system.
If you did not migrate your account yet, visit

SDB:Apache FastCGI and PHP-FPM configuration

Jump to: navigation, search


php-fpm is harder to configure than apache2-mod_php, but it provides some advantages:

  1. Support event mode (mod_php only supports prefork mode)
  2. Support HTTP2
  3. Better performance

How to

Remove and disable apache2-mod_php7:

sudo zypper remove apache2-mod_php7
sudo zypper a2dismod php7

Install and enable apache2-mod_fcgid and php7-fpm:

sudo zypper install apache2-mod_fcgid php7-fpm
sudo a2enmod proxy_fcgi setenvif

Create php7-fpm configuration:

sudo cp /etc/php7/fpm/php-fpm.conf.default  /etc/php7/fpm/php-fpm.conf
sudo cp /etc/php7/fpm/php-fpm.d/www.conf.default /etc/php7/fpm/php-fpm.d/www.conf

Start and enable PHP-FPM deamon:

sudo systemctl start php-fpm
sudo systemctl enable php-fpm

Edit Apache FastCGI configuration:

sudo vi /etc/apache2/conf.d/mod_fcgid.conf

At the end of file, change:

#<FilesMatch "\.php$">
#    AddHandler fcgid-script .php
#    Options +ExecCGI
#    FcgidWrapper /srv/www/cgi-bin/php7 .php


<FilesMatch "\.php$">
    SetHandler "proxy:fcgi://localhost/"