I found this error while trying to update and install composer packages with composer install
.
could not find driver (SQL: select * from information_schema.tables where table_schema = folio_burns and table_name = folio_items and table_type = 'BASE TABLE')
At first, I thought the solution was to edit /etc/php/7.4/cli/php.ini
(for PHP-FPM 7.4 in my case) and uncomment the line ;extension=pdo_mysql
to be like extension=pdo_mysql
. But I was still getting this error as the mysql
extension was missing.
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20190902/pdo_mysql (/usr/lib/php/20190902/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
The solution ended up being to install the extension, which would also add its own .ini
file and activate itself on installation.
sudo apt-get install -y php7.4-mysql
Note that you can run this command with multiple extensions to be installed at once.
sudo apt-get install -y php7.4-{xml,bcmath,gd,mbstring,xsl,zip,curl,mysql}