PDO - MYSQL driver not working

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

PDO - MYSQL driver not working

Post by infolock »

Hello all.

Basically, I'm trying to install PDO with MySQL support on a RedHat
server.

I ran the following commands:
pecl install pdo
pecl install pdo_mysql

I edited the php.ini file and added the following 2 lines:
extension=pdo.so
extension=pdo_mysql.so

I rebooted Apache. It shows PDO installed, but ONLY with the sqlite2
and sqlite extensions installed!!!

I then tried uninstalling pdo_mysql and running this command:
PHP_PDO_SHARED=1 pecl install pdo_mysql

rebooted Apache and the SAME PROBLEM!!!

I cannot for the life of me figure out how to fix this issue. Has
anyone else had this issue? It works fine for FreeBSD but for whatever
reason I can't get it to work on RedHat.

Also, why is it that SQLite is installed?? I can't find it anywhere in
the php.ini file as being an installed extension, and yet PDO is using
it's driver by default and completely ignoring my extension.

here is what it shows in phpinfo():

PDO
PDO support enabled
PDO drivers sqlite2, sqlite

pdo_sqlite
PDO Driver for SQLite 3.x enabled
PECL Module version (bundled) 1.0.1 $Id: pdo_sqlite.c,v 1.10.2.6.2.2
2007/03/23 14:30:00 wez Exp $
SQLite Library 3.3.17

Also, I tried connecting through a basic script and it reports error:
"can not find driver".

I'm using PHP 5.2.3


Here is the configure command:

'./configure' '--with-apxs2=/web/apps/apache-2.2.4/bin/apxs'
'--disable-debug' '--enable-ftp' '--enable-inline-optimization'
'--enable-magic-quotes' '--enable-mbstring' '--enable-mm=shared'
'--enable-safe-mode' '--enable-track-vars' '--enable-trans-sid'
'--enable-wddx=shared' '--enable-xml' '--with-jpeg-dir=/usr/lib'
'--with-dom' '--with-gd=/usr/lib' '--with-gettext'
'--with-mysql=/web/apps/mysql-5.0.45' '--with-regex=system' '--with-xml'
'--with-oci8=instantclient,/usr/include/oracle/10.2.0.3/client'
'--with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib'
'--with-zlib-dir=/usr/lib'
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: PDO - MYSQL driver not working

Post by Chris Corbyn »

Does normal MySQL work? I ask because it could be that the mysqlclient stuff isn't installed.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: PDO - MYSQL driver not working

Post by infolock »

yep, mysql is installed, and works using the old school methods (mysql_connect($blah)). I actually have this resolved now. It's an issue with PHP 5.2.3 and the PECL installer. Upgrading to PHP 5.2.6 and using the registered ./configure method fixes it.
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Re: PDO - MYSQL driver not working

Post by andre_c »

Did you install the mysql-devel package? I think it's required before you run: pecl install pdo_mysql

Alvaro
Post Reply