Ubuntu – How to activate PHP7.0 PDO in 16.04 LTS


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?

Best Answer

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