P粉2421267862023-08-24 13:03:53
The dsn in the code shows that you are trying to connect to the mysql driver. Your error message indicates that the driver is not available.
Check whether the mysql extension is installed on your server.
In Ubuntu/Debian, you can check the package using the following command:
dpkg --get-selections | grep php | grep mysql
If there is no php5-mysql package, please install it.
In Ubuntu/Debian you can use:
sudo apt-get install php5-mysql
sudo apt-get install php7.0-mysql
Finally, to make it work, you need to restart the web server:
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/nginx restart
P粉5205457532023-08-24 12:28:32
You need to have a module called pdo_mysql. Look for the following in phpinfo(),
pdo_mysql PDO Driver for MySQL, client library version => 5.1.44