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,569
  • 16
  • 74
  • 100
FRANK POLAN
  • 143
  • 1
  • 1
  • 5

4 Answers4

37

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 
BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
NGRhodes
  • 9,380
  • 47
  • 56
2

If the problem persists, do:

sudo apt install php7.0-sqlite3
BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
0

For earlier versions:

sudo apt-get install php7.4-pdo
BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77
Begoodpy
  • 111
  • 2
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
  • 116,445
  • 54
  • 318
  • 493