Since installing the Zend optimizer once upon a time, my os X machine has troubles getting php to work at the command line. Instead of a working php cli, a dyld error is returned. The problem has its roots in installing the Zend Optimizer, then attempting to update php to a version that did not have a version of the Zend Optimizer that worked with the intel cpu on Apple OS X. A situation that Zend did not seem in a hurry to fix when I gave up waiting.
The workaround was to point the command line php to the entropy.ch version.
Download and install the latest entropy.ch php package, then:
# cd /usr/bin
# cp php xphp
# rm php
# ln -s /usr/local/php5/bin/php php
# php -v
Now instead of the dyld error, I get a working php cli because no attempt is made to load the Zend libraries. Had the Zend Optimizer never been installed, likely I would not have had to change anything in the Leopard version of os X.
The March 2008 security update from Apple, updates the default php version. That was nice of Apple to make updating php versions as simple as installing a packaged update. But it breaks this workaround. To fix, repeat the steps, inserting a #rm xphp at line 2.
Not recommended for testing or commercial use, not supported by anyone. But hopefully will save someone with similar troubles some time figuring out the details themselves.
The php used by your apache server and the php available at the command line are two distinct binaries.
To determine which libphp5.so your apache is actually using..
# pico /private/etc/apache2/httpd.conf
And find in httpd.conf the line
To find other possible binaries that you could load into apache for testing..
# locate libphp5.so
You can use..
# locate pearcmd
# locate php-config
and poke around a little to get an idea of which php binaries are installed where on your system.
Three on my system. And that was after removing MAMP. No wonder I get confused. Not that it takes much.
For entropy version of pear..
# /usr/local/php5/bin/pear list
And finally, it is nice to see Apple realization that open source software requires periodic updates included in a user friendly, packaged format.