Dec 15, 2008

PHPMyAdmin on OS X Leopard

The other day I installed phpmyadmin on my MacBook and ran into an ugly error that said Cannot load mcrypt extension. Please check your PHP configuration. Yuck. I think the issue is that the version of PHP5 that ships with Leopard wasn't built with the mycrypt library. No fiddling I could do fixed my issue and I didn't want to recompile a new version of PHP just to use phpmyadmin. Especially when other solutions exist. Still, if you want to get phpmyadmin running on Leopard, click through and check out the most painless way.


The secret here is that older versions of phpmyadmin are almost as good. Sure phpmyadmin 3 has the mycrypt issue but phpmyadmin 2.7 doesn't. Tracking down an older version is pretty easy, but here's one source for those of you too lazy to get it.

Once you have it downloaded and sitting in your Sites folder, you'll notice an error the first time you fire it up. It probably looks like this:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)


Fortunately, this one isn't terribly difficult to solve. First we'll want to confirm the socket that MySQL is running on. Do that by typing:

mysqlconfig --socket


If all goes well you'll see a path like /tmp/mysql.sock Write that down.. you'll need it. Use your favorite text editor and open the config.default.php file in your phpmyadmin folder. You'll want to look for these two lines and change them to match the following:

$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock'; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'socket'; // How to connect to MySQL server ('tcp' or 'socket')


When you reload phpmyadmin things should be working now. Enjoy!

1 comment:

  1. on linux (ubuntu) i fixed with:

    sudo apt-get install php5-mcrypt

    ReplyDelete