After upgrading to Mac OS X 10.11/El Capitan it is time to check if the webserver is still working as it should.
The file httpd.conf inside /etc/apache2 holds the main configuration of Apache. We want to check if the PHP5 and Userdir modules are loaded correctly.
Make sure the following lines are not commented out, if there is an asterisk in front of it then remove that:
LoadModule php5_module libexec/apache2/libphp5.so LoadModule userdir_module libexec/apache2/mod_userdir.so
Also for mod_userdir make sure the following line is not commented out as well. It is referencing to an additional confguration file containing module options:
Lastly edit the file /private/etc/apache2/extra/httpd-userdir.conf and uncomment the following line:
This will make sure that for every ~username/ on your server the corresponding username.conf configuration is loaded.
Restart the webserver using the following command:
sudo apachectl restart
If you have configured the userdir module you should have a file name username.conf for each user that uses the webserver inside the /etc/apache2/users directory.
Those config files usually look like this:
<Directory "/Users/username/Sites/"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>
Unfortunately this file contains some obsolete parameters so it will not work. Change the lines:
Order allow, deny Allow from all
Require all granted
If you want to play with .htaccess options within your web projects then you should change
AllowOverride None into
AllowOverride All as well.
So the correct file syntax should now look like this:
<Directory "/Users/username/Sites/"> Options Indexes MultiViews FollowSymlinks AllowOverride All Require all granted </Directory>
If you changed any of these options you need to restart the webserver to load in the new configuration.
Test if PHP5 works by creating a small PHP script useing the following code snippet (or use one of your own scripts of course):
<?php phpinfo(); ?>
Save this snippet as phpinfo.php in your ~/Sites/ directory and run it in your browser as http://localhost/~username/phpinfo.php. This should give you a nice listing of your PHP configuration.
sudo port install mariadb-10.0
This will install MariaDB and all of its dependencies.
sudo port select mysql mariadb-10.0
The above command will set mariadb as the default MySQL server. Now we need to setup the default database structures. If you have old databases you can skip this step. This page has more information about this step.
sudo mysql_install_db --user=mysql
The following plist file can be used to start up the server at each boot:
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" > <plist version='1.0'> <dict> <key>Label</key><string>org.macports.mariadb-10.0-server</string> <key>ProgramArguments</key> <array> <string>/opt/local/bin/daemondo</string> <string>--label=mariadb100-server</string> <string>--start-cmd</string> <string>/opt/local/lib/mariadb-10.0/bin/mysqld</string> <string>--user=_mysql</string> <string>;</string> <string>--pid=exec</string> </array> <key>Debug</key><false/> <key>Disabled</key><true/> <key>KeepAlive</key><true/> </dict> </plist>