Mac as Server
Running Commands First, open the Terminal app and switch to the root user so you can run the commands in this post without any permission issues:
sudo su - Enable Apache on Mac OS X apachectl start Verify It works! by accessing http://localhost
Enable PHP for Apache Make a backup of the default Apache configuration. This is good practice and serves as a comparison against future versions of Mac OS X.
cd /etc/apache2/ cp httpd.conf httpd.conf.bak
Now edit the Apache configuration. Feel free to use TextEdit if you are not familiar with vi.
vi httpd.conf
Uncomment the following line (remove #) - press X over the letter and save with :wq
LoadModule php5_module libexec/apache2/libphp5.so Restart Apache:
apachectl restart
You can verify PHP is enabled by creating a phpinfo() page in your DocumentRoot.
The default DocumentRoot for Mac OS X El Capitan is /Library/WebServer/Documents. You can verify this from your Apache configuration.
grep DocumentRoot httpd.conf Now create the phpinfo() page in your DocumentRoot:
echo '<?php phpinfo();' > /Library/WebServer/Documents/phpinfo.php Verify PHP by accessing http://localhost/phpinfo.php
cd /path/to/project/folder python -m SimpleHTTPServer 8080