HTTP Server: Apache 2.4

PHP method #3: PHP-FPM

by ross at 12:49:29 on August 1, 2014

The method described here requires Apache version 2.4.10 or above.

Install, configure and start PHP-FPM.

PROXY_FCGI Apache option should be enabled (it is by default).

Edit httpd.conf, make sure these lines are present and not commented out:

LoadModule proxy_module libexec/apache24/mod_proxy.so
LoadModule proxy_fcgi_module libexec/apache24/mod_proxy_fcgi.so

These modules should be commented out or absent: php5_module, fcgid_module.

Create apache24/modules.d/030_php-fpm.conf:

<IfModule proxy_fcgi_module>
    <IfModule dir_module>
        DirectoryIndex index.php
    </IfModule>

    <FilesMatch "\.(php|phtml|inc)$">
        SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>
</IfModule>

Restart Apache:

# service apache24 restart

 

Comments
Hi Ross,

Thank you for this instructions. I configured apache to use php-fpm using your instructions. I am testing the php using phpinfo() to see if it's working but I get a connection failed.

Here is the error log.
[proxy_fcgi:error] [pid 73086] [client remote_address] AH01079: failed to make connection to backend: 127.0.0.1, referer: mydomain.com/

What am I doing wrong here?

Thank you for the help.
-- mcac
Thursday, May 14, 2015, 23:15:37
seems like php-fpm is down

# service php-fpm start
-- ross
Friday, May 15, 2015, 5:35:03
For some odd reasons, I tested it just a while back with the same configurations and it is working. Thank your for the guidance.
-- mcac
Saturday, May 16, 2015, 1:23:37