14

I upgraded from 14.04LTS to 16.04LTS; php5 to php7.0; MySQL to 5.7. Apache and PHP are working but when trying to access MySQL databases, I get the following:

fatal error: could not find driver

phpinfo() shows "no value" under PDO Drivers Enabled. Tried to compare php.ini from PHP5 but couldn't see anything obvious. Where do I go from here?

edwinksl
  • 23,789

4 Answers4

39

Installing php7.0-mysql should be enough:

sudo apt-get install php7.0-mysql

You will then need to ensure the module is enabled:

sudo phpenmod pdo_mysql

Then restart Apache to load the new modules:

sudo service apache2 restart 
NGRhodes
  • 9,490
2

If the problem persists, do:

sudo apt install php7.0-sqlite3
0

For earlier versions:

sudo apt-get install php7.4-pdo
Begoodpy
  • 111
0

Also try changing the file core/lib/vendor/symfony/lib/response/sfWebResponse.class.php.

You need to change preg_replace to preg_replace_callback for php7.0.

Eliah Kagan
  • 117,780