views:

1249

answers:

2

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 didnt 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.

Envrioment:

OS: UNBUNTU PHP Ver: 5.1.6 (Unable to upgrade due to clients live enviroment)

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 moduels are installed.I see:

PDO drivers     sqlite2

Thats it!

If any one could suggest any solutions to this I'd be deeply greatfull. 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. Doh!

Best Regards,

Ben

+2  A: 

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

Paul Tarjan
DEFINITELY use apt-get or aptitude.The whole advantage of using a popular distro, like Ubuntu, is that you manage *all* your software in *one* place. PEAR/PECL are more for Windows people, who are on their own with software management.
jared
I've discussed your suggested solution with the blioke in charge of our staging server (were the problem is occuring).He says that PHP was manually compiled and configured to exactly match the enviroment on our clients servers. He thinks may mean that apt-get is affecting UBUNTU's standard PHP release and not our custom version. Any thoughts?Thanks for taking the time to respond.
Ben Waine
A: 

To anyone having problems with this ensure that the following library is installed:

libmysqlclient15-dev

via:

sudo apt-get install libmysqlclient15-dev

Then use:

sudo apt-get install pdo_mysql

Without the 'libmysqlclient15-dev' library you'll have problems with pdo.

Found these pages to be quite helpful:

http://pecl.php.net/bugs/bug.php?id=12141
http://ubuntuforums.org/showthread.php?t=474152

Tyler K