7

For the last couple of days I've been getting the following error:

Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /home/mydomain/public_html/drupal/includes/database/mysql/database.inc on line 46

This comes after my Hosting did an upgrade and PHP is now version 5.2.17. From what they have told me, I think I have to enable a PDO MySQL extension in php.ini. The problem is I'm on a shared hosting and I don't have access to the file; also, my Hosting said they can't change it either. My info.php shows:

PDO

PDO support enabled
PDO drivers sqlite, sqlite2

pdo_sqlite
PDO Driver for SQLite 3.x enabled
PECL Module version (bundled) 1.0.1 $Id: pdo_sqlite.c 293036 2010-01-03 09:23:27Z sebastian $
SQLite Library 3.3.7

I tried modifying the .htaccess file and/or adding my own php.ini file to the root directory per some suggestions I found, but nothing I've tried has worked yet.

Can anyone please suggest what else I could do?

EDIT:

Once again I asked the Hosting to enable PDO_MySQL extension and their answer was that they could not, that cPanel (to which they migrated from Plesk, causing this whole problem) had this extension disabled by default and changing it would affect their servers. Their solution? That I would change my programming to adjust to these new features, which I wouldn't even know how to go about. Are they right requesting that I do this? Is there any other way?

2 Answers 2

8

Your hoster needs to enable that extension. I don't think you can do that in a local php.ini file.

I don't believe that they can't do it, they just need to add an extension=pdo_mysql.so to the php.ini, install the package, depending on whatever setup they are using. It's their job to do that, pdo_mysql is a hard requirement for Drupal 7.

3
  • I already asked them, but their reply was that due to restrictions on shared hosting accounts they can not alter the configuration, and that I only have whatever variables that are already enabled under info.php.
    – brunn
    Commented Jun 17, 2012 at 20:32
  • Then you need to look for another hosting provider. I wouldn't want to rely on a hosting provider that is incapable of enabling a PHP extension :)
    – Berdir
    Commented Jun 18, 2012 at 5:59
  • After escalating this with the hosting they finally enabled the extension. But I already talked my client into changing to another provider :) Thank you.
    – brunn
    Commented Jun 18, 2012 at 15:35
0

In my case when I swap PHP version in WAMP this error stopped me. I checked my phpinfo() then i observed PDO is enable but it's value is Blank

Solution : Go to in your php.ini file and find "extension_dir" and changed it's path to current working php's ext directory.

ex/: extension_dir = "c:/wamp/bin/php/php5.2.9/ext/"

Restart you wamp, it will start working again ....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.