I always forget about my PHP development environment when I upgrade OS X. Apple must think it’s really funny to make developers figure out what’s changed and how to fix it. Snow Leopard brings us PHP 5.3, which apparently requires a value in the date.timezone setting or your code will produce warning messages. Unfortunately, this value isn’t set in the php.ini file shipped with 10.6. Here’s how to fix:
- Open Terminal
- Run this command to rename the php.ini.default file to php.ini: mv /etc/php.ini.default /etc/php.ini
- Open the new php.ini file in vi (or other editor if you wish) with superuser: sudo vi /etc/php.ini
- Search for the date.timezone key and set it to your timezone. Mine is America/New_York. You can find a complete list here.
- Save the php.ini file.
- Restart Apache with this command: sudo apachectl restart