Every time Apple releases a new version of macOS, I have to go in and re-configure Apache with PHP the way I want it. So this time, I thought I’d automate the configuration changes with a single command.
As in my previous guides for enabling Apache and PHP on Sierra 10.12 and El Capitan 10.11 before that, this post will update the instructions for macOS Mojave 10.14.2 which comes with Apache 2.4.34 and PHP 7.1.19.
There are many open source packages that require the "AMP" stack comprising Apache, MySQL and PHP (hence "WAMP" for Windows-Apache-MySQL-PHP and "MAMP" for macOS-Apache-MySQL-PHP). Since macOS 10.12 Sierra already includes Apache 2.4 and PHP 5.6, here's how to add MySQL 5.7.
Recently I realized that the latest macOS Sierra 10.12 upgrade also updated Apache and PHP to newer revisions (2.4.23 and 5.6.24 respectively), but reverted to the default configurations. My previous post on Enabling Apache and PHP on OS X 10.11 needed a slight change too.
Apache and PHP 5.5.27 are installed already in OS X 10.11 El Capitan, so just a little enabling is required.
Updated 12 Oct 2016: See the slightly updated guide for macOS 10.12 Sierra, which has been updated to Apache 2.4.23 and PHP 5.6.24.