Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)

like image 490
Mike Broyles Avatar asked Jul 01 '15 16:07

Mike Broyles


1 Answers

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:

  • http://blog.remirepo.net/post/2014/08/01/Apache-httpd-server-2.4.10-and-PHP-FPM-5.6-in-Fedora-21
  • http://blog.remirepo.net/post/2014/03/28/PHP-FPM-and-HTTPD-2.4-improvement

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>
like image 61
Remi Collet Avatar answered Oct 19 '22 22:10

Remi Collet