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
 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
 Database::openConnection('default', 'default') #2
 Database::getConnection() #3
 db_escape_table('cache_bootstrap') #4
 DrupalDatabaseCache->getMultiple(Array) #5
 DrupalDatabaseCache->get('module_implemen...') #6
 cache_get('module_implemen...', 'cache_bootstrap') #7
 module_implements('system_theme_in...') #8
 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!

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

1 Answer 1


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


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
    Commented Dec 7, 2015 at 21:33
  • 1
    @sємsєм I work in GNU/Linux and I've never had to modify the extension_dir Commented Dec 7, 2015 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
    Commented Jun 19, 2018 at 18:32

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