Building additional PHP modules on OSX

Normally I try to avoid dealing with PHP if at all possible, but there is now a PHP port of py-amqplib called php-amqplib, and I offered to help out with it a bit. Maybe partially out of guilt for having written the mess of Python code it was based on :)

I thought it would be handy to work on it using my MacBook. OS X 10.5 (Leopard) has PHP 5.2.6 built in standard, but unfortunately it doesn't have the bcmath extension included, which php-amqplib makes use of. Turns out building the module wasn't that difficult. This page got me going - although building bcmath was much simpler. Since I had the Apple Developer Tools for 10.5 installed, it was just a matter of ...

And then edit /etc/php.ini to make these two changes:

--- php.ini.default 2008-07-15 14:19:15.000000000 -0500 +++ php.ini 2008-12-08 21:44:52.000000000 -0600 @@ -483,7 +483,7 @@ user_dir = ; Directory in which the loadable extensions (modules) reside. -extension_dir = "./" +;extension_dir = "./" ; Whether or not to enable the dl() function. The dl() function does NOT work ; properly in multithreaded servers, such as IIS or Zeus, and is automatically @@ -595,6 +595,7 @@ ; needs to go here. Specify the location of the extension with the ; extension_dir directive above. ; Windows Extensions ; Note that ODBC support is built in, so no dll is needed for it.

After that, I was able to run the amqp_test.php file for the first time, sending a message and receiving it in py-amqplib's demo/