MySQL 5.1, PHP 5.3, and Mac OS X 10.6
After upgrading to Snow Leopard (Mac OS X 10.6) I found that my local MySQL installation no longer worked. Also, my local Apache server using PHP 5.2 no longer interpreted .html files as PHP as I’d set up before. I did some digging and came up with the following things to get it working again. Hope this helps.
MySQL
There isn’t a MySQL installer package for Snow Leopard yet so you’ll have to build it from source. (I know, really scary sounding, huh. I hadn’t compiled anything before this and was intimidated. But it’s easy. Promise.) Follow this extremely easy-to-follow tutorial by Dan Benjamin and then come right back here for the rest.
Apache & PHP
Welcome back. By now you should be able to connect to your shiny new MySQL instance. Now, if you load any PHP pages that use any of the date functions you’ll see this error (or something similar):
Warning: date() [function.date]: 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.
PHP 5.3 now requires the timezone to be specified instead of trying to guess at it.
- Open Terminal (/Applications/Utilities/Terminal).
- Copy the built-in
php.ini.defaultfile tophp.iniby typingsudo cp php.ini.default php.iniand pressing Return. Supply your password. - Edit
php.iniby typingsudo open php.ini. It should open in your default text editor. - Search the file for the phrase “timezone”. You’ll find a line that reads
;date.timezone =. Change it todate.timezone = America/Denver(or whatever timezone you choose from this list). Remember to delete the semicolon from the beginning of the line. - Because of some code I share with colleagues, I ended up needing to restore the
short_open_tagattribute by finding that phrase and setting the value toOn. - Also, MySQL couldn’t connect to anything until I commented out the
mysql.default_socketproperty by placing a semicolon at the beginning of the line. This lets it use the built-in value instead. - After making these changes to your
php.inifile you need to restart Apache to get it to read the new values in. In Terminal typesudo apachectl gracefuland test your local php code in your browser.
Happy coding!



