In your Apache virtualhost directive, you configure a php5 handler,
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
Options ExecCGI
In that instance, the FCGIWrapper entry is the php5 cgi binary. Other examples suggest creating your own script and calling that, having that script set options and in turn calling php.
For example,
FCGIWrapper /usr/local/bin/php .php
If you go with a wrapper script you can set options in that, if you don't (i.e. the first example), then you can set options directly in the Apache config files,
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidIOTimeout 60
FcgidMaxRequestsPerProcess 400
FcgidIdleTimeout 60
FcgidMinProcessesPerClass 0
</IfModule>
That's pretty much it for a basic FastCGI config, some of it varies by distribution or if it's self compiled, but the above is the basic necessary stuff.
There appears to be quite an extensive FAQ on something very similar to your query here,
Apache + Chroot + FastCGI + PHP FAQ - http://www.seaoffire.net/fcgi-faq.html
Best Answer
It is not possible to use an externally spawned FastCGI-aware process like the ones created by
php-fpm
with mod_fcgid. It simply lacks this feature.If you don't want to use mod_fastcgi, i.e. because you think it's too big or insecure or old, you might want to look at an alternative like mod_proxy_fcgi.
You might also be delighted to hear that Apache httpd 2.4 (and the current developer release in the 2.3 series) already comes with a mod_proxy implementation for FastCGI, incidentally also called mod_proxy_fcgi.