PDOException: Could Not Find Driver in PHP
Problem:
You encounter the "PDOException "could not find driver"" error when attempting to create a schema with Symfony2 on a Linux system running LAMP.
Cause:
The error suggests that PHP cannot locate the necessary MySQL driver. In your case, you have confirmed that the appropriate line for the MySQL driver is uncommented in the php.ini file but still encounter the issue.
Solution:
As indicated in the error message, PHP is unable to load the dynamic library for MySQL (/usr/lib/php5/20090626 lfs/mysql.so). To resolve this, open the terminal and execute the following command:
sudo apt-get install php5-gd php5-mysql
This command will install the required PHP modules, including MySQL, allowing PHP to locate and utilize the necessary driver for MySQL connections.
Once the installation is complete, rerun the Symfony2 command to create the schema. The error should no longer appear.
The above is the detailed content of Why Can\'t PHP Find the MySQL Driver in a LAMP Setup?. For more information, please follow other related articles on the PHP Chinese website!