Compile PDO drivers from source

November 15, 2007

It was troublesome but at last I did it. I googled it and found someone has done this before on 6.06 the good howto is here. The author was able to pecl install pdo then downloaded from source and compiled in the server the pdo_mysql driver. I wasn’t that lucky I have to start from PDO extension first using the same method.

For PDO extension

wget http://pecl.php.net/get/PDO-1.0.3.tgz
tar zxvf PDO-1.0.3.tgz
cd PDO-1.0.3
phpize

Note that modding the configure file is not necessary for PDO extension then proceed

./configure
make
make install

Do the same, more or less for PDO_MYSQL

wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
phpize
nano configure

Now carefully look for line 4163 which should read something like this
if test "x$is_it_shared" = "x" && test "x" != "xtrue"; then start commenting that line out until you see fi which is at line 4173. Check line number by doing ^C and go to the line you want by ^_[line number]

After that proceed

./configure
make
make install

Finally add below lines
extension=pdo.so
extension=pdo_mysql.so

to the bottom of files /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini. Don’t forget to start apache again by apache2ctl restart.

Watch careful for errors when it’s complied (make) and installed (make install) or else you’ll be like me doing this more than once.

Checking it again by phpinfo() to see your great achievement

Advertisements

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

%d bloggers like this: