Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY'
Asked Answered
S

3

11

Currently I'm getting this kind of message and I don't know how to fix it.

The command php -m tells me that PDO and pdo_mysql are there.

I'm using Drupal-8 with php7.1.20 on Ubuntu 18.04.1 LTS

[Tue Sep 04 09:27:48.210064 2018] [php7:notice] [pid 2183] [client 10.56.99.1:53758] Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /var/www/dev/web/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php on line 134 #0 /var/www/dev/web/core/lib/Drupal/Core/Database/Database.php(376): Drupal\Core\Database\Driver\mysql\Connection::open(Array)\n#1 /var/www/dev/web/core/lib/Drupal/Core/Database/Database.php(166): Drupal\Core\Database\Database::openConnection('default', 'default')\n#2 [internal function]: Drupal\Core\Database\Database::getConnection('default')\n#3 /var/www/dev/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(79): call_user_func_array('Drupal\\Core\\Dat...', Array)\n#4 /var/www/dev/web/core/lib/Drupal/Component/DependencyInjection/Container.php(171): Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'database')\n#5 /var/www/dev/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(260): Drupal\Component\DependencyInjection\Container->get('database', 1)\n#6 /var/www/dev/web/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(62): Drupal\Component\DependencyInjection\PhpArrayContainer->resolveServicesAndParameters(Array)\n#7 /var/www/dev/web/core/lib/Drupal/Component/DependencyInjection/Container.php(171): Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'cache.container')\n#8 /var/www/dev/web/core/lib/Drupal/Core/DrupalKernel.php(516): Drupal\Component\DependencyInjection\Container->get('cache.container')\n#9 /var/www/dev/web/core/lib/Drupal/Core/DrupalKernel.php(877): Drupal\Core\DrupalKernel->getCachedContainerDefinition()\n#10 /var/www/dev/web/core/lib/Drupal/Core/DrupalKernel.php(469): Drupal\Core\DrupalKernel->initializeContainer()\n#11 /var/www/dev/web/core/lib/Drupal/Core/DrupalKernel.php(665): Drupal\Core\DrupalKernel->boot()\n#12 /var/www/dev/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))\n#13 {main}

Surfboard answered 4/9, 2018 at 9:41 Comment(3)
S
25

Nvm.

apt-get install php-mysql and a simple service apache2 restart fixed atleast that error.

Surfboard answered 4/9, 2018 at 9:48 Comment(6)
I think this issue is more than well enough documented on the Drupal site and associated forumsClass
I visited most of the links u put up. Adding any extensions didnt work for meSurfboard
After lots of searching, this was the fix I needed. Thank you!Tawnytawnya
Thank you for documenting your solution!Bookplate
Thank you! works for meDecompound
apt-get install php7.2-mysql worked for me. ThanksCounseloratlaw
D
1

In case of amazon linux below command to install extension should help

yum install php-mysqlnd

In my case it had happened while trying to re-install php-pdo. removal command did remove the dependencies php-mysqlnd and php-pgsql. Installation did not add those dependencies.

Deportment answered 23/2, 2022 at 7:14 Comment(0)
M
1

This is what helped to me.

Just uncomment extension=pdo_mysql in php.ini and drush started to work:

Malamud answered 23/11, 2023 at 17:32 Comment(1)
Hi. Stack Overflow discourages use of images for code/error/debug/log messages. Images create problems for usability, readability, and searchabiilty among many other reasons. Please post the relevant content of the configuration file as text.Crepitate

© 2022 - 2024 — McMap. All rights reserved.