After installing OS X Leopard I quickly realized that the bundled PHP lacks a very important (at least to me) part. PDO MySQL.
UPDATE:
This was a a build that worked - almost. You couldn’t get GD, PEAR or PECL working. So I set out to fix this issue. But what - Sean Coates had already found the right way of doing it. So instead, use his way:
http://blog.phpdoc.info/archives/83-php-5.2.5-on-Leopard.html
But if you feel like a almost working setup - here’s the original post:
For some reason Apple included MySQL, MySQLi, PDO SQLite and PDO SQLite2, but not PDO MySQL. And because Pundit is highly dependent on PDO MySQL I had to find a solution..
Well - here it is:
1. Install the XCode developer tools (from the Leopard install cd, or downloadable from Apple)
2. Download and install MySQL from http://dev.mysql.com
3. Download PHP Source from http://php.net
4. Create some symlinks for the MySQL libraries (otherwise PHP won’t find them)
> sudo mkdir /usr/local/mysql/lib/mysql > sudo ln -sf /usr/local/mysql/lib/lib* /usr/local/mysql/lib/mysql/
5. Compile PHP - not as hard as it sounds..
> cd ~/where/you/placed/php > ./configure ‐‐with-pdo-mysql=/usr/local/mysql ‐‐with-apxs2=/usr/sbin/apxs ‐‐with-mysql=/usr/local/mysql ‐‐prefix=/usr ‐‐mandir=/usr/share/man ‐‐infodir=/usr/share/info ‐‐disable-dependency-tracking ‐‐with-ldap=/usr ‐‐with-kerberos=/usr ‐‐enable-cli ‐‐with-zlib-dir=/usr ‐‐enable-trans-sid ‐‐with-xml ‐‐enable-exif ‐‐enable-ftp ‐‐enable-mbstring ‐‐enable-mbregex ‐‐enable-dbx ‐‐enable-sockets ‐‐with-iodbc=/usr ‐‐with-curl=/usr ‐‐with-config-file-path=/etc ‐‐sysconfdir=/private/etc ‐‐with-mysql-sock=/var/mysql ‐‐with-mysqli=/usr/local/mysql/bin/mysql_config > make all > make install
6. Restart Apache
sudo apachectl graceful
7. Check that it worked. There are a gazillion ways of doing so, here’s one:
> php -i | grep PDO
Check the output for a line like: PDO Driver for MySQL, client library version => 5.0.45
8. …
9. Profit!
Disclaimer: I have no idea if this breaks anything. It worked for me, and I haven’t found anything broken yet.. I didn’t break stuff, but it was the best either. Read update at top of post..
-fangel
November 19th, 2007 | Personal
Sorry - the layout seems to screw with the statement..
It’s (with added spaces for clarity)
- - with - pdo - mysql
So every switch on the command is dash dash, then the name - and not like the layout changed it into - a single dash..
-fangel
November 24, 2007, 12:46 pmUpdated the post with the correct amount of type of dashes. Should work better now..
-fangel
November 24, 2007, 12:55 pmJust dropping a line to say thanks. I don’t even know what PDO is but I had to install it on my ibook to work on a project and thanks to your article I could find the solution really quick.
February 8, 2008, 3:53 pmYou’re welcome Daniel. I hope you went with Coates’ way. His is better..
February 8, 2008, 4:54 pm
Comment by André Neves
Hi,
i’m getting the following:
configure: warning: –with-pdo-mysql=/usr/local/mysql: invalid host type
configure: warning: –with-apxs2=/usr/sbin/apxs: invalid host type
configure: error: can only configure for one host and one target at a time
any idea? Thanks.
November 23, 2007, 2:43 pm