dqmq0654 2015-05-29 12:25
浏览 90
已采纳

Laravel:错误[PDOException]:无法在MySQL中查找驱动程序

I'm trying save a register in my MySQL database using Eloquent of Laravel 5

I edited database information in .env file, localized in my system root path, and in config/database.php maintain 'default' => 'mysql' and other mysql connection information (it using env('DB_DATABASE', 'forge') for get informations)

I can use Migration, but when I trying save register using function save() of my Model:

$newClient = new Client;
$newClient->name = "John";
$newClient->save();

It will occur the fallowing error:

PDOException in Connector.php line 47:
could not find driver

enter image description here

================================================================ For @user3158900:

I think my PHP has MySQL extension installed, fallowing my phpinfo() about Mysql

enter image description here

>php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
gd
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
pdo_sqlsrv
Phar
Reflection
session
SimpleXML
soap
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]
  • 写回答

1条回答 默认 最新

  • douxu0550 2015-05-29 12:55
    关注

    If you are using WAMP, your webserver and command line are using different php configurations.

    Be sure to enable the pdo_mysql extension in both config files or using the WAMP options.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?