Kevin Warrington

Loading clever subtitle...

Setup PHP With Apache and on the CLI

Install PHP using brew:

1
2
3
brew update
brew search php5
brew install php56

Locate libphp.so

1
2
3
sudo /usr/libexec/locate.updatedb
locate libphp5.so
# /usr/local/Cellar/php56/5.6.5/libexec/apache2/libphp5.so

Tell Apache which PHP shared object .so to use:

1
2
3
4
5
httpd -V | grep ROOT
# -D HTTPD_ROOT="/usr"
vi /etc/apache2/httpd.conf
# this following path is relative to /usr
LoadModule php5_module local/Cellar/php56/5.6.5/libexec/apache2/libphp5.so

Add PHP to your path:

1
2
export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"
php -v

Comments