Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How To Build mod_fastcgi For Apache2 On OpenSUSE 12.2  (Read 4973 times)

0 Members and 1 Guest are viewing this topic.

dustin

  • Guest
How To Build mod_fastcgi For Apache2 On OpenSUSE 12.2
« on: October 22, 2013, 11:56:22 pm »

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

apache2ctl -t

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
server1:/etc/apache2/sites-available #

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:

 
Building mod_fastcgi

First make sure that apache2-devel is installed:

zypper install apache2-devel

Download the latest mod_fastcgi sources and build them as follows:

wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
tar xvfz mod_fastcgi-2.4.6.tar.gz
cd mod_fastcgi-2.4.6/
cp Makefile.AP2 Makefile

ln -s /usr/include/apache2-worker/mpm.h /usr/include/apache2/
make top_dir=/usr/share/apache2
make top_dir=/usr/share/apache2 install

Make sure you have the line

LoadModule fastcgi_module modules/mod_fastcgi.so

in /etc/apache2/sysconfig.d/loadmodule.conf.

Finally restart Apache:

/etc/init.d/apache2 restart