Many help sites that show you how to install and configure the Apache module mod_fcgid ask you to uninstall the Generic Apache PHP module(mod_php5).
Although mod_fcgid offers some advantages to the mod_php5, uninstalling the mod_php5 need not be, especially if you are running applications that don’t need to run under mod_fcgid and it uses simple vhosts configurations. Example of these applications are: phpMyadmin, mantis etc.
The only problem really in trying to combine them is that the default configuration of mod_php5 does interfere with the configurations of mod_fcgid.
Take it from my experience where I struggled for 3 days trying just about everything in the book to make the mod_fcgid configuration work.
Finally I found that the mod_php5 default configuration of Debian Squeeze/Wheezy uses the FilesMatch block to assign all php files to SetHandler application/x-httpd-php which forces the use of mod_php5 for all .php files.
It seems that this configuration has full priority in Apache and although Apache doesn’t complain at all about mod_fcgid configuration, the mod_php5 is still the one used no matter what.
Solution:
Simple: Comment out(disable) the whole configuration in /etc/apache2/mods-available/php5.conf and add the following line in each VirtualHost configuration where you want the Apache-php5 module to run your scripts and use the FCGI configuration for all other VirtualHosts.
Eg. Add the follwoing line in each VirtualHost for default (php5-module) use:
AddType application/x-httpd-php .php .phtml .php3 .php4
and use the following configuration for all FCGI-php5 run VirtualHosts:
SuexecUserGroup liveblog liveblog
<Location />
AddHandler fcgid-script .php
FCGIWrapper /var/www/my.website.com/php-fcgid-starter .php
Options -Indexes +ExecCGI +FollowSymlinks
</Location>
NOTE: The above configuration is only the VirtualHost part of it, other settings and configuration of the web server to make it all work is not described here. The advantages of the FCGI-php5 run web sites, is mostly for WordPress or CMS driven sites where, the WordPress or CMS needs to have the ability to change the local files for uploading plugins/modules/gadgets etc. If the default user is used(www-data) then unless one gives the ownership of the directoris and files to www-data(dangerous) the CMS needs to have manual administration interventions direct on the server to make the needed changes.
Reload apache2:
/etc/init.d/apache2 reload
To see if the mod_fcgi module is used, watch the system processes and the users they are belonging to while calling a site that should use mod_fcgi.
Example of the command:
watch 'ps aux | egrep "apache|cgi" | grep -v grep'