How to force httpd to use rh-php56 from red hat software collections

Mike Broyles picture Mike Broyles · Jul 1, 2015 · Viewed 17k times · Source

Anyone have any luck with making httpd use rh-php56 from the Red Hat Software Collections?

I see documentation on how to enable the newer version of php at the CLI...but not for making Apache use the new version of PHP installed via the rh-php56 package.

(I should clarify -- this is for a RHEL 7.x box)

Answer

Remi Collet picture Remi Collet · Jul 14, 2015

rh-php56 provides mod_php only for httpd24 (not for base system)

Simpler way is to use php-fpm (which also allow to run apache in threaded mode)

See:

To summarize above post, use in /etc/httpd/conf.d/php.conf

# Redirect to local php-fpm is mod_php not available
<IfModule !mod_php5.c>
    <FilesMatch \.php$>
        SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>
</IfModule>