I am trying to start a new project with the latest CiviCrm in the latest Drupal. In composer.json I have "civicrm/civicrm-core": "^5.68" and "drupal/core-recommended": "^10.1". Civicrm/cli-tools are installed and vendor/bin/cv gives a list of available commands.
Error: Undefined constant PDO::MYSQL_ATTR_USE_BUFFERED_QUERY on installing CiviCrm.
I attempt to install CiviCrm with these instructions
cv core:install --cms-base-url="https://d10.example.org" --db="mysql://database_user:database_pass@localhost:3306/civicrm_database"
but
Error: Undefined constant PDO::MYSQL_ATTR_USE_BUFFERED_QUERY in /home/nigel/Documents/ddev/d10-civi/web/core/modules/mysql/src/Driver/Database/mysql/Connection.php on line 157 #0 /home/nigel/Documents/ddev/d10-civi/web/core/lib/Drupal/Core/Database/Database.php(451): Drupal\mysql\Driver\Database\mysql\Connection::open()
Googling suggests I should install php extensions pdo and pdo_mysql. In .ddev/php/my-php.ini I have
[PHP]
extension=pdo.so
extension=pdo_mysql.so
Then ddev restart.
But php -m shows that pdo is now installed but not pdo_mysql.
Can anyone see what I’m missing?
EDIT: NEXT DAY: SOLVED (this is so dumb)
I enabled CiviCrm Core in /admin/modules. Drupal, bless it, enabled Civi with no problem.
ddev drush cr caused an error message -
Warning: Module "PDO" is already loaded in Unknown on line 0
PHP Warning: Module "pdo_mysql" is already loaded in Unknown on line 0
I deleted .ddev/php/my-php.ini and restarted ddev. Now ddev drush cr works with no erors.
Hope this helps someone.
pdo
andpdo_mysql
are both installed and enabled by default in DDEV, so you don't have to do anything with installing them.But please note that the database URL you have will be completely wrong. The db host is
db
, so is the user=db
, pass=db
, database=db
. You are trying to set it up as if the db server were onlocalhost
, etc.ddev describe
will tell you more about your project, and readhttps://ddev.readthedocs.io/en/latest/users/usage/database-management/
for a bit more about db management.