Installing PDO_MYSQL on PHP 5.1.6 using PECL OS: Ubuntu

Ben Waine picture Ben Waine · Jul 2, 2009 · Viewed 14.8k times · Source

I'm having real problems getting PDO_MYSQL working.

I started by just trying to install the PDO_MYSQL driver via PECL, however when this didn't work I looked round to see if there where any issues reported. It seems that there may be a conflict between the embedded version of PDO and PDO_MYSQL. To that end i decided to reinstall all it's dependencies from PECL.

Environment:

OS: Ubuntu
PHP Ver: 5.1.6 (Unable to upgrade due to clients live environment)

Procedure Followed:

PECL uninstall PDO_MYSQL
PECL uninstall PDO
PECL uninstall mysql
PECL install mysql
PECL install PDO
PECL install PDO_MYSQL

Lines Added to PHP.ini
extension=mysql.so
extension=pdo.so
extension=pdo_mysql.so

apachectl restart
[warn] php5_module is already loaded, skipping

I then check PHPINFO to see which modules are installed. I see:

PDO drivers     sqlite2 

That's it!

If any one could suggest any solutions to this I'd be deeply grateful. I need MYSQL PDO driver to run zend framework for an upcoming project... and yes I have to use v1.6 due to the PHP version.

Answer

Paul Tarjan picture Paul Tarjan · Jul 2, 2009

If you're on ubuntu, try apt-get :

sudo apt-get install php5-mysql

which should make

/usr/lib/php5/20060613+lfs/pdo.so

and PDO will be available after an apache restart