Fixing PHP PDO after Mac OS X Update

A Mac is set up to do web development out of the box, but I decided to build PHP 5 and MySQL 5 from source for a number of reasons. I prefer to use PHP’s PDO wrapper in my data access layer, not those database specific mysql_* functions. So I followed the instructions at HiveLogic and others.

But when I updated my Mac OS X to 10.5.3 I lost the MySQL PDO configuration. This had also happened when I installed previous 10.5 updates. Fortunately I had kept my configuration in a script. So if you too want to re-configure the PHP PDO for MySQL on your Mac, here is what to do.

Open terminal and cd to you php directory. then run configure:

	'./configure' \
	'--prefix=/Users/matt/php' '--with-xsl=/usr' \
	'--with-apxs2=/usr/sbin/apxs' '--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-pdo' \
	'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config' \
	'--with-mysql=/usr/local/mysql' \
	'--with-mysql-sock=/tmp/mysql.sock' \
	'--with-openssl' '--with-xmlrpc' \
	'--without-pear' \
	'--with-soap'

You might want to put that mouthful in a shell script and call it something witty like config-php-pdo.sh. Now run:

	make

then:

	sudo make install

Now you should be able to restart apache (from either the command line or from System Preferences > Sharing panel) but that has not worked for me. I had to restart the OS.

Advertisements
Fixing PHP PDO after Mac OS X Update

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s