If you are new to web development using Mac, you may ask how to enable PHP module on OS X 10.11 El Capitan along with Apache web server. This post shows you how to enable it.
OS X 10.11 El Capitan Beta 5 which was released on August 19 comes pre-built with PHP 5.5.27 and Apache 2.4.16. You can start Apache web server using
apachectl command as root / super user. However by default the PHP module is not enabled.
You can follow this simple task as below:
1. Uncomment the ‘php5_module’ to load the PHP module.
/etc/apache2/httpd.conf and uncomment the following line:
LoadModule php5_module libexec/apache2/libphp5.so
2. Still in editing the file, inside the ‘mime_module’ directive, add the following line:
AddType application/x-httpd-php .php
3. You may also need to activate ‘index.php’ file by adding it inside ‘dir_module’ directive as below:
DirectoryIndex index.php index.html
Restart the apache service then try to access a .php file (for example info.php which shows php information)
Hopefully this brief post will be useful for all of you who want to activate PHP module with Apache on OS X 10.11 El Capitan.