Upgrading a server to Mac OS X 10.6 Snow Leopard
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.
PHP and MyQSL
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
Beautiful.
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.
- Bug #48534 Infinite loop with: log_errors+display_startup_errors+no timezone
- “Instead of being loud or use a keyboard with a broken caps lock, can you please read carefully what I wrote earlier last month? ‘Will be fixed after 5.3.0’ I think it is clear.”
- eAccelerator
- “eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.”
- What is new in PHP 5.3 - part 3: mysqlnd: Gergely Hodicska
- “The overview of the advantages of mysqlnd over libmysql: high integration with the Zend Engine, faster execution, lower memory footprint, performance statistics for bottle-neck analysis, easier compilation, own development life cycle, usage of PHP stream API, client side query cache and a lot of possibility for future features.”
More Snow Leopard
- QTKit duration in Snow Leopard Server
- The QTMovie duration method returns a tuple in Snow Leopard, so the media duration script needs to be slightly modified.
Thanks a lot for the helpful reference! I just wanted to mention, however, that I needed to upgrade the entire MySQL install explicitly (using the x86_64 package from MySQL.com) in order to get DBD::MySQL to work properly. Otherwise I got a large number of linker errors...
Guest at 9:27 a.m. September 15th, 2009
7ODjL
Yes, I found this, too: only the 64 bit version worked for DBD:mysql.
However, I've got an additional problem. Although web pages loaded through apache will now correctly run DBD:mysql, I find that scripts run on the command line fail with lazy linker errors:
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
Expected in: flat namespace
Trace/BPT trap
Anyone got any suggestions?
Nathaniel at 4:11 p.m. September 30th, 2009
JcS67
Figured it out - it was my recent install of Fink screwing me up somehow.
Nathaniel at 2:09 a.m. October 1st, 2009
gCIQJ