By bendqh1 on
I host a Drupal 9 website on shared hosting with CentOS, Apache, MariaDB 10.3, Mysqli support enabled and PHP 8.1.
I first installed this website with the command composer create-project drupal/recommended-project.
I ran the following commands to upgrade the Drupal 9 core to Drupal 10:
cd example.com
composer update
chmod 777 web/sites/default
chmod 666 web/sites/default/*settings.php
chmod 666 web/sites/default/*services.yml
composer require 'drupal/core-recommended:^10' 'drupal/core-composer-scaffold:^10' 'drupal/core-project-message:^10' --update-with-dependencies --no-update
composer update
vendor/bin/drush updatedbI then got:
Error: Undefined constant PDO::MYSQL_ATTR_USE_BUFFERED_QUERY in Drupal\mysql\Driver\Database\mysql\Connection::open() (line 148 of /home/example.com/web/core/modules/mysql/src/Driver/Database/mysql/Connection.php).
Why do I get this error and what can be done against that?
Comments
This problem is not similar
This problem is not similar to this issue
as you suggested in your e-mail to me. It seems like that error occurs if something is wrong with your PHP installation, more specifically the pdo/pdo_mysql extensions not being installed.
Some references:
I suggest you check your shared hosting settings and contact them if you can't figure it out.
Does this error also happen if you enable and visit update.php through the browser? If not, this will probably be an issue with the CLI PHP installation, not with PHP-FPM. Make sure the right PHP executable is used when running vendor/bin/drush updatedb.
Indeed example.com/update.php
Indeed example.com/update.php worked.
I tend to think that this is indeed a PHP extension problem. Sadly in this shared server I have very little control about which such extensions are installed.
You can find which PHP
You can find which PHP installation FPM is using by visiting /admin/reports/status/php and looking for 'Configuration File (php.ini) Path'. For the CLI you can use php -i | grep "Configuration File (php.ini) Path". If those paths are different you can try to use the FPM PHP installation in your CLI by including the path to the right php binary in the PATH variable before running Drush, like this:
Changing "/RunCloud/Packages/php81rc/bin" to the path of the PHP installation FPM uses, or just the path to an installation using the right PHP version and including the necessary PHP modules.
I am not a PHP programmer.
I am not a PHP programmer. Some terms here are foreign for me (FPM).
This is what I have found in the phpinfo() file:
I hope it helps helping me.
This problem now happens in
This problem now happens in all Drupal websites I have.
The server PHP version is 8.1 and pdo and pdo_mysql are both installed.
I have created a new thread here:
https://www.drupal.org/forum/support/post-installation/2023-01-03/sudden...
Please follow:
Please follow:
https://github.com/drush-ops/drush/issues/5351
I was able to fix this on my
I was able to fix this on my new Ubuntu install with by installing the php-mysql package:
sudo apt install php-mysqlsudo service apache2 restartthanks
fIX in debian
The issue occurred when I
The issue occurred when I updated to PHP 8.1.
I needed to make sure I had the php-pdo and the php-mysqlnd extensions installed.
How did you install those two
How did you install those two extensions (php-pdo and php-mysqlnd)? And in what path?
Using an account that has
Using an account that has `sudo` permissions (can run commands as the `root` user), run the appropriate one of these for your operating system. The apt/yum commands will automatically install the code into the proper locations.