I’ve been putting off upgrading the OS on my iMac at home for a while. But last night, I finally got to doing it. And, surprise surprise!!! My personal web server goes bust, and my chicken recipes posted on my private mediawiki installation become inaccessible!!! There’s my ridiculously elaborate, yet true, excuse for not cooking last night, and eating out yet again :) (I promise, I will start cooking one of these days!)

Well, I have encountered this issue a few times before in the past. (During every OS upgrade to be precise) So, I decided to document my fix this time. Apple has a habit of being overly concerned for its users’ security, and changes certain config files and permissions back to their default state, completely ignoring the time and effort the user (me) put into getting things to work just right!

Here’s my setup:

I have MySQL hosting my wiki’s database, and MediaWiki, which is built on PHP, running on Apache2 that comes pre-installed on the mac. It’s basically, mod_php on apache talking to mysql. Pretty simple… and Apple screwed up all three parts of my setup.

First, Apple reverts changes to my httpd.conf, thus disabling mod_php.

Second, a bigger change, Apple took away the System Preference checkbox for Personal Web Sharing, which was the simple way to start/stop apache.

Third, Apple reverts the permissions on the file used for Unix socket connection between PHP and MySQL. Well, technically the permissions on the tmp folder where the socket file resides.

Fixes:

1. uncomment the line that loads mod_php in httpd.conf (found under /etc/apache2). Basically find the line that says:

#LoadModule php5_module libexec/apache2/libphp5.so

 and remove the # to uncomment it, so that it looks

LoadModule php5_module libexec/apache2/libphp5.so 

I have all my content located at the default /Library/WebServer/Documents location, so I didn’t have to change anything else. But, if you used a different DocumentRoot in the past, you may need to reconfigure those settings as well.

2. The UI might have gone missing, but Apache2 still comes installed with your mac, so fire up your Terminal, and run.

> sudo apachectl start

or, to make sure it starts every single time, the launch control is still available as well…

> sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist 

The -w will make it permanent.

3. Make the MySQL socket accessible for PHP

> sudo mkdir /var/mysql

> sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock


Voila! My recipes are back online now! But, I don’t have any chicken to cook.