0

This question already has an answer here:

I have working development project of Drupal 7 using PHP 5.x. I changed the PHP version to PHP 7 using nginx webserver. It does not work and I have got the following error message:

 Fatal error: Uncaught Error: Undefined class constant
 'MYSQL_ATTR_USE_BUFFERED_QUERY' in
 C:\xampp-2\htdocs\d738\includes\database\mysql\database.inc:46 Stack
 trace: #0 C:\xampp-2\htdocs\d738\includes\database\database.inc(1689):
 DatabaseConnection_mysql->__construct(Array) #1
 C:\xampp-2\htdocs\d738\includes\database\database.inc(1479):
 Database::openConnection('default', 'default') #2
 C:\xampp-2\htdocs\d738\includes\database\database.inc(2570):
 Database::getConnection() #3
 C:\xampp-2\htdocs\d738\includes\cache.inc(348):
 db_escape_table('cache_bootstrap') #4
 C:\xampp-2\htdocs\d738\includes\cache.inc(329):
 DrupalDatabaseCache->getMultiple(Array) #5
 C:\xampp-2\htdocs\d738\includes\cache.inc(56):
 DrupalDatabaseCache->get('module_implemen...') #6
 C:\xampp-2\htdocs\d738\includes\module.inc(723):
 cache_get('module_implemen...', 'cache_bootstrap') #7
 C:\xampp-2\htdocs\d738\includes\module.inc(892):
 module_implements('system_theme_in...') #8
 C:\xampp-2\htdocs\d738\modules\system\system.module(2502):
 module_invoke_all('system_theme in
 C:\xampp-2\htdocs\d738\includes\database\mysql\database.inc on line 46

This error means that Drupal 7 is using obsoleted MySQL functions and it is not support with PHP any more!

However, I don't think Drupal still uses this obsoleted PHP extension. So I have a strange error as I think!

marked as duplicate by kiamlaluno 7 Dec 8 '15 at 4:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What is the question? Are you looking for a way to fix this, or a confirmation that Drupal doesn't work with PHP 7? – kiamlaluno Dec 7 '15 at 21:31
  • Indeed, I wanted both, I found the error message strange. it talks about mysql_ the obsoleted extension – SaidbakR Dec 7 '15 at 21:35
  • Actually, the class is DatabaseConnection_mysql, a Drupal class. – kiamlaluno Dec 7 '15 at 21:37
  • There is an open core issue on PHP 7 support: drupal.org/node/2454439 – cilefen Dec 8 '15 at 13:57
4

Search and edit your php.ini file, you must search this line:

;extension=php_pdo_mysql.dll

remove the ; and save the file, then restart your webserver.

  • Oh yes, the phpinfo() output tricked me! However, just as my case, when use non global installation of PHP i.e not have path environment value, you have to uncomment the extension_dir directive. – SaidbakR Dec 7 '15 at 21:33
  • 1
    @sємsєм I work in GNU/Linux and I've never had to modify the extension_dir – Adrian Cid Almaguer Dec 7 '15 at 21:39
  • I did this and am still getting the "PHP Fatal error: Uncaught Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY'" – Christia Jun 19 '18 at 18:32

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