[HOW-TO] Use "mod_fastcgi_handler + PHP-FPM" instead of "mod_fastcgi + PHP-FPM" (Less code to work on)

I have read about mod_fastcgi_handler which I think it will help me to write less code to work on PHP-FPM. Checked their website, even they say it's beta quality and there are a couple bugs. I still think I should try it. So, below is what I did to replace mod_fastcgi with mod_fastcgi_handler. 1. Put the command below into the SSH.
wget https://github.com/hollow/mod_fastcgi_handler/tarball/master --no-check-certificate
tar xvfz hollow-mod_fastcgi_handler-v0.4-0-g8973a51.tar.gz
cd hollow-mod_fastcgi_handler-8973a51
apxs -i -a -o mod_fastcgi_handler.so -c *.c
2 .Check /etc/httpd/conf/httpd.conf if mod_fastcgi_handler.so is there or not. (It should already be there after compile.) 2.1 Open httpd.conf
nano -w /etc/httpd/conf/httpd.conf
2.2 Check if there is a line below :
LoadModule fastcgi_handler_module /usr/lib/apache/mod_fastcgi_handler.so
3. Then, just edit httpd.conf per user to have the code below : (Let's say the user is ADMIN.)

3.1 Edit httpd.conf per user :
nano -w /usr/local/directadmin/data/users/admin/httpd.conf
3.2 Put the code below: Comment out anything else. (Anything related to mod_fcgid, mod_fastcgi)
<IfModule mod_fastcgi_handler.c>
        <Files ~ (\.php)>
               SetHandler fcgi:/fcgi/admin/public_html/admin.sock
After put that code it, the entire Virtualhost will look like below :
<VirtualHost xxx.xxx.xxx.xxx:80 >
        ServerName www.bxtra.net
        ServerAlias www.bxtra.net bxtra.net
        ServerAdmin webmaster@bxtra.net
        DocumentRoot /home/admin/domains/bxtra.net/public_html
        ScriptAlias /cgi-bin/ /home/admin/domains/bxtra.net/public_html/cgi-bin/

        UseCanonicalName OFF

        SuexecUserGroup admin admin
        CustomLog /var/log/httpd/domains/bxtra.net.bytes bytes
        CustomLog /var/log/httpd/domains/bxtra.net.log combined
        ErrorLog /var/log/httpd/domains/bxtra.net.error.log

        <Directory /home/admin/domains/bxtra.net/public_html>
                Options +Includes -Indexes
                <IfModule mod_fastcgi_handler.c>
                    <Files ~ (\.php)>
                         SetHandler fcgi:/fcgi/admin/public_html/admin.sock
You can see that the code is a lot less than before. Also note that, any configuration in "/etc/httpd/conf/extra/httpd-info.conf " that I have shown you about mod_fastcgi in previous tutorial. You can ignore it. No need to do that anymore.

Tested with below software :
1. CentOS 5.4 / 5.5 - 64 bits
2. DirectAdmin 1.37 - With Custombuild 1.2
3. Apache 2.2.17 - Worker MPM
4. PHP 5.3.5 + PHP-FPM
5. mod_fastcgi_handler 0.4
6. APC 3.1.7

Note :
After tested it for a few hours, I found it's unstable. I sometime got AHAH error when uploading image. Sometime when saved setting, I got "Error 302 Moved Temporarily" like below :

Moved Temporarily

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@bxtra.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

For now, I have to switch back to use mod_fastcgi + PHP-FPM. So, do it at your own risk :)

Source :
- https://github.com/hollow/mod_fastcgi_handler
- http://forum.nginx.org/read.php?3,153067