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?


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 
  • I am using nginx. Shall I follow same steps and then restart nginx ? – Vivek Sadh Jul 10 '17 at 8:55
  • 1
    @VivekSadh On nginx you probably use php-fpm and therefore need to restart the php server: /etc/init.d/php7.0-fpm restart – Simon Fakir Aug 10 '17 at 19:51
  • Yeah I figured it out that day. Thx! – Vivek Sadh Aug 17 '17 at 7:47
  • works for php 7.2 too. sudo apt-get install php7.2-mysql – boroboris Feb 3 at 22:16

If the problem persists, do sudo apt install php7.0-sqlite3


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.