dmy

Mediawiki on MacPorts

written by admin 2826 days ago. Last update at 2013-04-02 16:29:26. Categories admin, macports. Tags , , , .

The installation of Mediawiki is not without pain, especially when using MacPorts on MacOS X. A repeating problem is the location of MySQL’s socket file. For unkown or rather questionable reasons, MacPorts moved that file from it’s default location in folder /tmp to

/opt/local/var/run/mysql5/mysqld.sock

Even worse, the file’s name, usually mysql.sock, has now changed into mysqld.sock. So it comes to no surprise that applications like PHP, Mediawiki and oh-you-name-it simply choke. Except if you also install those via MacPorts. Then you may have a chance that it works.

Personnally however I don’t like this all-or-nothing approach. Ideally I would like to have a system where MacPorts lives in a friendly coexistence with tools not provided by MacPorts. Wouldn’t it be good if there were a kind of registry knowing about locations? Unfortunatly, such a registry beast is still missing on UNIX based platforms. As much as I like the UNIX approach, all those config file locations and dialects drives me crazy.

So how would Mediawiki know that my MySQL’s configuration file is burried deep in /opt/local/etc and that furthermore, MySQL got pached to use that fancy location mentioned above?

Well, it simply can’t figure it out.

Now, you may think that’s no problem then. We just tell Mediawiki where it is. That’s not going to work either as long as you are unwilling to wrestle with Mediawikis PHP code: joy-oh-joy, it’s just hardwired to /tmp/mysql.sock. Period. So, what you need to do is to ask good old ln -s for rescue:

% sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock

This works eventually but it’s really ugly cause the problem with links is that after a while no one knows why this link was created in the first place.

Happy Hacking.