setup apache + php environment on macOS 10.12.6
step 1: start httpd by apachectl
> sudo apachectl start
step 2: find httpd.conf
> sudo apachectl -t -D DUMP_INCLUDES
step 3: edit conf, eg: /opt/local/etc/apache2/httpd.conf
> sudo vim /opt/local/etc/apache2/httpd.conf
step 4: Load php module before <IfModule unixd_module>, eg:
```
LoadModule php5_module /usr/libexec/apache2/libphp5.so
<IfModule unixd_module>
```
step 5: add mod_php5.c end of httpd.conf
```
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
```
step 6: save and quit
step 7: restart httpd
> sudo apachectl restart
step 8: write demo.php , test configuration
```
<?php
phpinfo();
?>
```
step 9: copy demo.php to "DocumentRoot", you can find by httpd.conf
step 10: visit demo.php
all done.