简体   繁体   中英

PDO: 'Could not find driver'

I asked this question and followed the instructions.

  • I removed the default mysql driver sudo apt-get remove --purge php5-mysql
  • I installed the Native Driver sudo apt-get install php5-mysqlnd
  • I ran sudo php5dismod mysql && php5enmod mysqlnd
  • I restarted php5-fpm and nginx

At this point I was presented with the following error:

[2016-04-14 08:50:02] local.ERROR: exception 'PDOException' with message 'could not find driver' in /var/.../vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47

Why does PDO say Could not find driver ?

The solution (for php-fpm/nginx) was to modify the mysql.ini configuration within the mods-available directory.

sudo vi /etc/php5/mods-available/mysql.ini

I replaced: extensions=mysql.so with extension=mysqlnd.so

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM