How to set up Apache, PHP & MySQL on Mac OS X 10.11 El Capitan & OS X 10.10 Yosemite

sudo nano -w /etc/apache2/httpd.conf
#LoadModule userdir_module libexec/apache2/mod_userdir.so
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
#LoadModule php5_module libexec/apache2/libphp5.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
DirectoryIndex index.html
DirectoryIndex index.html index.php
#Include /private/etc/apache2/extra/httpd-userdir.conf
sudo nano -w /etc/apache2/extra/httpd-userdir.conf
#Include /private/etc/apache2/users/*.conf
ls /etc/apache2/users/*.conf
sudo nano -w /etc/apache2/users/danilo.conf
<Directory "/Users/danilo/Sites/">
Options Indexes MultiViews FollowSymLinks
Require all granted
AllowOverride All
Order allow,deny
Allow from all
</Directory>
sudo cp /etc/php.ini.default /etc/php.ini
sudo chmod 644 /etc/php.ini
sudo nano -w /etc/php.ini
error_reporting = 
error_reporting = E_ALL | E_STRICT
display_errors = Off
display_errors = On
;date.timezone =
date.timezone = America/Los_Angeles
sudo nano -w /etc/php.ini
pdo_mysql.default_socket=
pdo_mysql.default_socket=/tmp/mysql.sock
mysql.default_socket = 
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket =
mysqli.default_socket = /tmp/mysql.sock
nano -w ~/.bash_profile
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
source ~/.bash_profile
mysql_secure_installation
sudo apachectl restart
http://localhost/
http://localhost/~danilo/
<?php phpinfo(); ?>
http://localhost/~danilo/info.php

--

--

Entrepreneur, Technologist & Product Guy

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store