Could not find driver - PDO_mysql错误解决办法

前台错误:

Could not find driver

 

phpinfo错误提示:

PDO drivers: no value

 

解决办法:

  1. 找到php.ini路径(通过 phpinfo()即可看到)
  2. 修改php.ini,启用“extension=pdo_mysql
  3. 重启apache: "sudo apache2ctl restart"
  4. 还不行的话,应该是pdo_mysql.so丢失了,先找到php版本,例如7.2
  5. 重装连接用的扩展:"sudo apt install php7.2-mysql",根据PHP版本自行修改
  6. 重启apache: "sudo apache2ctl restart"
  7. OK!

 

图示

(1 / 2)

Could not find driver - PDO_mysql错误解决办法

(2 / 2)

Could not find driver - PDO_mysql错误解决办法