How To Build mod_fastcgi For Apache2 On OpenSUSE 12.2
Author: Falko Timme
Follow me on Twitter
mod_fastcgi is needed for Apache prior to 2.4 to work with PHP-FPM. There is an apache2-mod_fastcgi package for OpenSUSE, but unfortunately it is buggy: it does not allow you to use the FastCgiExternalServer directive inside a vhost, although the official mod_fastcgi documentation says that this is allowed. This guide explains how to build a new mod_fastcgi from the sources for Apache2 on an OpenSUSE 12.2 system to fix this problem.
I do not issue any guarantee that this will work for you!
mod_fastcgi can be used to make Apache2 work together with PHP-FPM (see Using PHP5-FPM With Apache2 On OpenSUSE 12.2). Unfortunately, if you decide to use the FastCgiExternalServer directive inside a vhost configuration, Apache will refuse to start, and
gives you this error:
server1:/etc/apache2/sites-available # apache2ctl -t
Syntax error on line 57 of /etc/apache2/sites-enabled/100-example.com.vhost:
FastCgiExternalServer cannot occur within <VirtualHost> section
The official mod_fastcgi documentation says that FastCgiExternalServer can be used in the global server configuration and also in vhost configurations, so this is a bug in OpenSUSE's apache2-mod_fastcgi package. We can build our own mod_fastcgi as follows:
First make sure that apache2-devel is installed:
zypper install apache2-devel
Download the latest mod_fastcgi sources and build them as follows:
tar xvfz mod_fastcgi-2.4.6.tar.gz
cp Makefile.AP2 Makefile
ln -s /usr/include/apache2-worker/mpm.h /usr/include/apache2/
make top_dir=/usr/share/apache2 install
Make sure you have the line
Finally restart Apache:
That's it. You've just replaced OpenSUSE's mod_fastcgi module with your own one.
- Apache: http://httpd.apache.org/
- mod_fastcgi Documentation: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
- OpenSUSE: http://www.opensuse.org/