Homebrew, Apache, and PHP Extensions

I recently switched from MacPorts to Homebrew. The installation and setup of a Homebrew LAMP stack, using MariaDB and josegonzalez/homebrew-php, went smoothly. I used the following sources:

I included PHP extensions intl and opcache when installing with Homebrew. However, Moodle install insisted that the extensions were not available. While php -m showed the intl extension, phpinfo() showed a different version of PHP, and that neither extension was installed.

After a great deal of research, I discovered that I had missed a step when reverting from MacPorts back to my native apache install. I needed to direct Apache to load the appropriate version of PHP.

cd /etc/apache2
sudo sublime httpd.conf

In httpd.conf, I commented out the default PHP location and pointed Apache to the Homebrew installation of PHP:

# LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php5_module /usr/local/Cellar/php55/5.5.11/libexec/apache2/libphp5.so

Moodle's install status check and phpinfo() now give me the correct results.

comments powered by Disqus