Skip to content

Instantly share code, notes, and snippets.

@candh
Last active March 10, 2018 14:05
Show Gist options
  • Save candh/21d95e7f0a21a90ba2a0a7a69a3d4d15 to your computer and use it in GitHub Desktop.
Save candh/21d95e7f0a21a90ba2a0a7a69a3d4d15 to your computer and use it in GitHub Desktop.
php56 on mac os sierra with the apache2 server included with the OS
# install php56
$ brew tap homebrew/homebrew-php
$ brew install php56 --with-httpd
$ brew unlink httpd
# enabling sites folder
$ mkdir ~/Sites
# adding a ${USERNAME}.conf in /etc/apache2/users/
$ cd /etc/apache2/users
$ sudo nano username.conf
# add the following and replace username with your own username
<Directory "/Users/username/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
# configuring httpd.conf
$ sudo nano /etc/apache2/httpd.conf
# uncomment these modules
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
# uncomment this line
Include /private/etc/apache2/extra/httpd-userdir.conf
# comment out these modules
LoadModule php7_module libexec/apache2/libphp7.so
# add the php5module
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
# Override .htaccess and allow URL Rewrites
AllowOverride All
# add this please
ServerName localhost
AddType application/x-httpd-php .php
# save and exit
$ sudo nano /etc/apache2/extra/httpd-userdir.conf
# uncomment
Include /private/etc/apache2/users/*.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment