title: Setting up PHPFPM with Apache+mod_FastCGI
body: <p>I recently took over a WebServer that is running PHP and Apache.  PHP is currently utilizing PHPFPM through the mod_fastcgi of Apache.  Everything is running fine, however during my research to make sure I understand the in-and-outs of the implementation, I have ran into a puzzling configuration.  On the Apache WebServer, the following is used:</p>
  
  <pre><code>ScriptAlias /php-cgi "/usr/local/bin/php-cgi"    
  AddHandler php-fastcgi .php    
  Action php-fastcgi /php-cgi
  FastCGIExternalServer /usr/local/bin/php-cgi -socket /tmp/php-fpm.sock -idle-timeout 60 -pass-header Authorization
  </code></pre>
  
  <p>Now, as mentioned before the above configuration works fine.  But it would seem that this configuration is using TWO solutions - the PHP-CGI solution and PHP-FPM solution.  From my readings and understanding, PHP-FPM offers a replacement for PHP-CGI, not something that runs along side it.  Therefore, I am thinking the following configuration is supposed to be in place:</p>
  
  <pre><code>ScriptAlias /php-cgi "/usr/local/sbin/php-fpm"    
  AddHandler php-fastcgi .php    
  Action php-fastcgi /php-cgi
  FastCGIExternalServer /usr/local/sbin/php-fpm -socket /tmp/php-fpm.sock -idle-timeout 60 -pass-header Authorization
  </code></pre>
  
  <p>The second configuration (using PHP-FPM) also works.  I have not been able to notice anything between the two, but it concerns me that one or the other is effectively wrong.</p>
  
  <p>Would anyone mind sharing their thoughts, findings, or answer which configuration is SUPPOSED to be in place?  I don't like the idea of running php-cgi when I should be running php-fpm.</p>
  
  <p>Thanks ahead of time,
  Jason</p>