Mamp
Last updated
Last updated
Setting up macOS with Apache, MySQL and PHP.
The guide uses the default Mac OSX Apache and PHP along with for installing MySQL.
Open the Apache server configuration file httpd.conf
for editing
Set the server name to localhost
Configure document root for sites folder (create ~/Sites
if needed)
Set log file location and create folder if needed
Enable the PHP module (add or uncomment)
Expand directory index file extensions (not required when other/php7.conf
is used)
Enable the virtual hosts configuration file (add or uncomment)
Edit Apache vhosts configuration file
Remove sample configs and add new vhost
Start (or restart
) Apache to activate new config
Create a php.ini
file
Add your timezone to date.timezone to stop PHP date warning (eg. America/Los_Angeles
)
Configure MySQL socket setting, find and set the following
Open the etc hosts file
Add entries for each virtual host
Install MySQL with Homebrew (Latest: msyql
or Version: msyql@5.7
)
And MySQL bin folder to path (reload shell to activate)
Start MySQL server
Secure MySQL installation
Step through MySQL secure installation procedure
Set a root password
Remove anonymous user
Disallow root login remotely
Remove test databases
Reload privileges
Default user sites location
Base Apache files location
Default Apache page (contains default index page)
Location of MySQL database files
(For additional error reporting when developing, download the related distribution from and use php.ini-development
contents for php.ini
config)