Forcing Apache2 to use php56 from Homebrew

2019-02-28 14:06发布

问题:

So I started with

brew reinstall php56 --with-apache

This worked fine I then amended httpd.conf to include

LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so

But upon inspection of phpinfo its using PHP 5.6.24 which is wrong, thats the MacOS native version. The brew version is 5.6.26.

For some reason my Apache2 config is being ignored - or I have amended the wrong file. The one I changed as in /etc/apche2/httpd.conf

This is a follow on from my previous question related to getting APCu working. Its working for the brew version of PHP but is not working for the the native PHP version. Therefore I want to force Apache2 to use the brew version with APCu.

回答1:

I was restarting apache, but it was not working it turns out.

Restarting my whole machine did work and apache then used the correct version of PHP.

Apparently killall httpd has the same effect too. Although I have not tried that.