PDOException "Driver not found" in php
P粉478445671
2023-08-29 14:04:38
<p>I have installed Lampp on my linux system and I am learning symfony2 while trying to create schema using symfony2 command</p>
<pre class="brush:php;toolbar:false;">php app/console doctrine:schema:create</pre>
<p>I received the following error message: -</p>
<pre class="brush:php;toolbar:false;">PDOException “could not find driver”</pre>
<p>I also uncommented the line <code>extension=php_pdo_mysql.dll</code></p> in the php.ini file
<p>I tried finding and searching for my problem but I couldn't solve my problem. When I run the <code>php -m</code> command I get the following result: -</p>
<pre class="brush:php;toolbar:false;">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
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
----
----</pre>
<p>Is there any way to eliminate this problem? </p>
In Ubuntu, write
in the consoleIt will work
Hopefully you are running your project in localhost. There is a file named parameters.ini in your project folder app/config, make sure your Mysql database connection is configured correctly. If you use mysql, see
database_driver=pdo_mysql
is the driver for it.Below is an example.
hope it helps you.