Category archives:

Dec 11 OSX System Update broke Java, and I had to fix it again

Upgrading from OSX 10.5 Leopard to OSX 10.6 Snow Leopard had some unexpected consequences for the Java installation, basically ditching Java 1.5 and only having Java 1.6. I would think most Java based apps would be fine with an upgrade, but, then again, I’m not a Java man.

I found that Zend Studio had some strange issues when starting up (it didn’t) and the answer was to get the original OSX 10.5 Java 1.5 and put it back where it could be used and do some finagling with settings to let applications use it. It’s all spelled out in this article on how to fix Snow Leopard’s Java Problem

After this past friday’s software update though, it happened again. After a little bit of research and some trial and error, I found out that I had to re-do a part of the previous fix.

Specifically, I had to re-update the symlink for 1.5.0 in /System/Library/Frameworks/JavaVM.framework/Versions so it was pointed at my 1.5.0-leopard folder. I’m not sure if I’ll need to update my other 1.5 related folder to not point to the CurrentJDK.

My /System/Library/Frameworks/JavaVM.framework/Versions directory now looks like this:

1.3        -> 1.3.1
1.4        -> CurrentJDK
1.4.2      -> CurrentJDK
1.5        -> CurrentJDK
1.5.0      -> 1.5.0-leopard
1.6        -> 1.6.0
Current    -> A
CurrentJDK -> 1.6

All of these were updated on Dec 11 when I did the update. So a quick

sudo ln -snf 1.5.0-leopard 1.5.0

And things were good.

Timing command line functions

Yet another basic command line tool that is awesome:


This lets you do a quick and dirty profile on some code you’re executing.

Basic Usage

time <command>

This will execute the command and put out a summary detailing how long the command took in total, how long it was tied up in actual execution, and how long it was tied up in system overhead:

real	0m0.031s
user	0m0.004s
sys	0m0.023s

Another nifty function that does one thing and one thing only, but does it well. Thanks Unix philosophy!

Apache, PHP, Snow Leopard and Oracle conspired to kill me, but I didn’t let them!

In a nice epilogue to my post about how Apache, PHP, Zend Debugger and Snow Leopard are conspiring to kill me, I have good news!

Thanks to Zend’s release of a 64-bit version of the Zend Debugger for Mac OSX, I finally got to get everything working together nicely in 64-bit world.

I ended up doing a complete format and re-install of Snow Leopard, since I had too many 32-bit binaries laying around. This gave me a great opportunity to clean up my computer too. Double win!

Along the way, I had a couple of hurdles…

  • iconv continued to throw defined symbol errors. Tried manually compiling iconv in 64-bit but that didn’t work, eventually just went with a Macports install and that worked. Also, tacked “-liconv” to the end of my EXTRA_LIBS in the Makefile. For good measure.
  • Tacked “-lresolv” to the end of EXTRA_LIBS in the Makefile too, thanks to this handy PHP on Snow Leopard reference
  • I used Macports to install the GD related stuff, since the native OSX build of PHP references were broken
  • We use Oracle as a backend at work, and I had gotten the Oracle Instant Client working on my Leopard build but was having a hell of a time getting it working on Snow Leopard.

All of this repeated many times over the past couple of days, trying to get OCI8 to work properly:

  • Downloaded the Instant Client Basic, SDK and SQL*Plus from Oracle
  • Unpacked them all into /opt/oracle/instantclient_10_2
  • Recompiled PHP with “–with-oci8=instantclient,/opt/oracle/instantclient_10_2,10.2″
  • Got lots and lots of “PHP Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system – please check that DYLD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries”
  • Tried setting the environment variables via
    • Bash shell
    • /etc/profile
    • SetEnv in the Apache configs
    • putenv() on the script
    • Voodoo

    But none of it worked.

The problem was that I had made the decision to use the default install of Apache that came with OSX, which has ever so slightly different rules associated with it.

Eventually, I found out about plist files, and how OSX’s Apache ends up caring about them. So a quick addition to /System/Library/LaunchDaemons/org.apache.httpd.plist and an Apache restart later and my DYLD_LIBRARY_PATH woes were over!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

By adding lines 19 to 25, the environment variables given are passed along to PHP via Apache and eventually the Oracle Instant Client.

Other than the OCI issues, the recompiling of PHP went smoothly. Of course, this is in large part thanks to what I learned on my previous adventures in PHP OSX compilation. I’d still like to know more about .plist files, but for now, I’m happy that I’m back up and running where I need to be.

Apache, PHP, Zend Debugger and Snow Leopard are conspiring to kill me

After an OS upgrade to Snow Leopard, I find myself unable to rebuild PHP.

  • iconv still throws undefined symbol errors. This is no longer fixable by adding -liconv to the EXTRA_LIBS in the Makefile
  • MH_BUNDLE_FLAGS needs to be moved to the end of the group at line 155 otherwise I get more undefined errors
  • After giving up on doing it manually, Macports install of tidy gives a fatal error about lazy symbol binding failing
  • Many of my libraries were built as 32-bit, though this was easy to rectify
  • Even after giving up on iconv and tidy, ZendDebugger is not available for 64-bit on OSX yet. At least, not that I can get to.

That last one is the kicker, since I really enjoy having the debugger so well integrated with Zend Studio 5.5.

So for the time being, it looks like I’ll be staying with the install I’ve got. Unless Zend releases a 64-bit version for OSX, my next step will be to figure out how to compile as 32-bit so I can retain control over my install.

Entirely too many hours spent on getting this to work, and I end up using Time Machine to restore my old install. Hooray for frequent backups though. Otherwise I’d have had to recompile all of my old libraries as 32-bit. And that would have been the end of me.

Update: Success!