MySQL PDO

From ThinkyWiki

Jump to: navigation, search

In order to use MySQL with Drupal 7 you need to build, install, and enable the MySQL PDO extension for PHP. You can do this by adding the --enable-pdo and --with-pdo-* configure directives. But if you already have PHP installed and don't want to wait, this procedure will be quick and painless.

First get the latest PHP from http://www.php.net/downloads.php. Decompress the archive and use the following commands in Terminal:

cd php-5.2.11/ext/pdo_mysql

MACOSX_DEPLOYMENT_TARGET=10.6 \
CFLAGS='-O3 -fno-common -arch x86_64' \
LDFLAGS='-O3 -arch x86_64' \
CXXFLAGS='-O3 -fno-common -arch x86_64' \
./configure --prefix=/usr --with-pdo-mysql=/usr/local/mysql --with-zlib-dir=/usr

make && sudo make install

Edit /etc/php.ini and make sure the pdo_mysql extension is enabled with the line:

extension=pdo_mysql.so

Restart Apache and you should have a working MySQL PDO for Drupal 7.

Personal tools