Home > Database > Mysql Tutorial > body text

How to Fix \'PDOException: could not find driver\' in Symfony2?

DDD
Release: 2024-11-02 09:19:02
Original
669 people have browsed it

How to Fix

PDOException "could not find driver" in PHP

When attempting to create a schema with the Symfony2 command:

php app/console doctrine:schema:create
Copy after login

You may encounter the error message:

PDOException “could not find driver”
Copy after login

Despite uncommenting the line extension=php_pdo_mysql.dll in the php.ini file, the issue persists. Additionally, running php -m yields the following warnings:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
Copy after login

Solution:

For Ubuntu systems, execute the following command in the console:

sudo apt-get install php5-gd php5-mysql
Copy after login

This command will install the necessary PHP modules, and the issue should be resolved.

The above is the detailed content of How to Fix \'PDOException: could not find driver\' in Symfony2?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template