I have to do this so often I decided to just put it on my site.
Apple didn’t include MySQL support for PDO within Mac OS X 10.5 (Leopard), much to the frustration of many PHP + Mac devs.
I’ve built pdo_mysql.so for Mac OS X using the 5.2.6 source and latest mysql source.
pdo_mysql.so (133kb MD5: 9f2d8b843a2031907a994ec62e7d2c45)
This works on my xserve, and desktop mac machines running 10.5.5 with the stock PHP 5.2.6 and MySQL 5.0.67 (i686) and 5.0.45 (powerpc).
Just place the file in /usr/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so and add extension=pdo_mysql.so to your /etc/php.ini file.
This should work on all the following architectures:
ucommbieber:no-debug-non-zts-20060613 bbieber$ file pdo_mysql.so pdo_mysql.so: Mach-O universal binary with 4 architectures pdo_mysql.so (for architecture i386): Mach-O bundle i386 pdo_mysql.so (for architecture x86_64): Mach-O 64-bit bundle x86_64 pdo_mysql.so (for architecture ppc7400): Mach-O bundle ppc pdo_mysql.so (for architecture ppc64): Mach-O 64-bit bundle ppc64
Here’s the address to download the extension http://saltybeagle.com/downloads/pdo_mysql.so
If you’d like the full details to build the extension yourself – see Tom Gidden’s post with all the info.
Thanks for this info. Good deal. I would love to catch up with you sometime on custom compiling web environments for Leopard on Xserves. I am doing this now myself running Leopard in VMWare 2.0. Ping me on the contact page of my blog. I work at UNC Charlotte.
Hey Brett, thanks for sharing this. I compiled pdo_mysql from source myself, but for some reason, I can’t get this extension to load. I tried with yours, and same thing. I have no error. I just don’t see it being loaded. Any idea ??
looks like you can’t do anything about it >.< http://discussions.apple.com/thread.jspa?threadID=1428703&tstart=491
@Tim "I have no error. I just don’t see it being loaded." No error would indicate it’s not being loaded. The error would be in the /var/log/apache2/error_log right when you start Apache if it couldn’t load the module. You can also use <?php dl(’pdo_mysql.so’); ?> to load it dynamically and see if there’s any problems.
@Brett hum, doesn’t work either.
"Warning: dl() [function.dl]: Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so’ – (null)"
I have it working on my mac mini on Tiger, so I guess I’ll just ssh into it, and work from there… Thanks for the help !