How To Build mod_fastcgi For Apache2 On OpenSUSE 12.2

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Fri, 2013-02-22 12:58. :: SuSE | Web Server | Apache

How To Build mod_fastcgi For Apache2 On OpenSUSE 12.2

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 02/18/2013

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!

 

Preliminary Note

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

That's it. You've just replaced OpenSUSE's mod_fastcgi module with your own one.

 

Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.