Lebowtech Blog

Fix PHP TimeZones After Upgrade to OSX 10.9 Mavericks

| Comments

Previously I wrote about how to Fix the time zone for DST in israel. Well if you did the free update to OS X 10.9 Mavericks, You’ll noticed that this stopped working.

The update moved your PHP.ini file, so first thing to do is get it back.

sudo cp /etc/php.ini-5.2-previous /etc/php.ini

Your old php.ini file might have been renamed to something else, so use ls -l /etc/php* to find the newest one.

Now if you try to run PHP it will probably complain that extension=timezonedb.so is missing’

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/timezonedb.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/timezonedb.so, 9): image not found in Unknown on line 0

So we need to build it again.

But if you try to use pecl you will get an error.

sudo pecl install timezonedb
downloading timezonedb-2013.7.tgz ...
Starting to download timezonedb-2013.7.tgz (195,474 bytes)
.........................................done: 195,474 bytes
5 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

Now is the fun, lets get our build tools back.

Start by downloading and installing the new XCode. Run it and accept the license.

Now we need to install the command line developer tools.

xcode-select --install

A window should pop up giving you instructions.

Now our php libraries should be in place, but autoconf and automake are gone.

The easiest way to get them back is to use homebrew.

brew install autoconf automake

You may need to link autoconf so follow the instructions that homebrew gives you.

Now you should be able to:

sudo pecl install timezonedb 

Now everything should be back to normal and your GeekTool to show שקיע (sunset) should work again.

1
2
3
4
#!/usr/bin/php
<?PHP
$tz = new DateTimeZone(date_default_timezone_get());
echo "שקיע:".date_sunset(time(),SUNFUNCS_RET_STRING,31.89402,34.820706,ini_get("date.sunset_zenith"),$tz->getOffset(new DateTime())/3600);

Comments