Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, PHP, and whatever else I happen to feel like hacking at.

Upgrading a server to Mac OS X 10.6 Snow Leopard

Jerry Stratton, September 10, 2009

Snow Leopard comes very close to being just a straight install for us. In the past I’ve had to add the MySQL module for PHP, and for that matter I’ve had to install Marc Liyanage’s PHP to get important features. Leopard began to change that, and Snow Leopard continues it.

There are still a couple of weird things, however.

Things Disappear

The Snow Leopard installer erases a lot. Any extra folders in /etc/apache2 will be removed. For example, we have a custom folder for custom configurations; that folder was gone completely and I had to restore it from backup.

I noticed this pretty quickly, because the installer did not remove references to those files and thus the web server spewed errors on startup.

This isn’t the only place that things disappear from, as you’ll see later.


Snow Leopard comes with something called mysqlnd to handle PHP’s pre-PDO MySQL functions. So far it seems to work fine.

old password error
If you have any old-style insecure passwords, mysqlnd will refuse to use them. The error is “mysqlnd cannot connect to MySQL 4.1+ using old authentication”. Remember that you can create a password for direct insertion into the mysql tables using SELECT PASSWORD('fred flintstone'). But, you know, consider updating the password after all this time.
no port error
The error is a bit cryptic: “Can't assign requested address”. What’s happening is that the default php.ini has a blank entry for MySQL’s default port. Set it to 3306 (assuming you use the standard port for MySQL) or specify the port when you make your connection.

PHP: bad date.timezone error

As soon as I started up PHP, I saw this frightening warning in PHP’s error log:

PHP Warning: PHP Startup: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead in Unknown on line 0

You’ll need to set date.timezone in php.ini to something like “America/Los_Angeles”, but even after you do that you’ll still receive a warning in your log files. If I’m reading the PHP site correctly, this is a bug in php 5.3.0 and will be fixed sometime later.

Double-check the output of phpinfo(), but despite the warning the date.timezone you’ve set in php.ini will take effect. (I used America/Chicago for testing to make sure that php wasn’t just using our server’s system time zone. Chicago’s timezone then appeared in phpinfo’s output despite the above error continuing to show up.)

PHP: eAccelerator

In the past, eAccelerator has always been a pain to install. Under Snow Leopard, eaccelerator 0.9.6-rc1 installed with no fuss whatsoever for us:

  • phpize
  • ./configure --with-eaccelerator-userid=_www
  • make
  • sudo make install


Note that judging from the release notes, you want at least 0.9.6 because that’s the first version that supports PHP 5.3.0. And of course don’t forget to add “extension="eaccelerator.so"” to your php.ini file along with whatever other settings you use.

Perl: MySQL

Perl’s different. I really think someone at Apple hates Perl. But then, I think someone at Perl hates Perl, too. I can never get cpan to work. I ended up downloading the DBD::MySQL source and DBD::MySQL installed simply:

  • PATH=/usr/local/mysql/bin:$PATH
  • perl Makefile.PL
  • make
  • sudo make install

No idea why cpan didn’t work.

Oh, and if you’re doing an upgrade you’ll probably have to restore the /usr/local/mysql alias that the Snow Leopard installer deleted. The actual folders with the long names (/usr/local/mysql-5.0.85-osx10.5-x86_64) are still there (or were for me) but the alias to the latest one was gone.

Python: MySQL

Meanwhile, Sourceforge doesn’t like easy_install. They changed the URL for downloading Python’s MySQLdb source, so for the moment you’ll need to give easy_install the actual URL. For example, instead of “easy_install MySQL-python” use (as I write this—the version number will likely change):

  • easy_install http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz?use_mirror=dfn

But at least easy_install actually works—Python’s MySQL module is another one of those things that used to require hacking into the source to successfully install.

  1. <- Django cache time
  2. Caching DTDs ->