Laravel:错误[PDOException]:无法在MySQL中找到驱动程序 [英] Laravel: Error [PDOException]: Could not Find Driver in MySQL
问题描述
我尝试使用 Laravel的
Eloquent
在我的 MySQL
5
I'm trying save a register in my MySQL
database using Eloquent
of Laravel 5
我在 .env
文件中编辑了数据库信息,路径和 config / database.php
维护'default'=> 'mysql'
和其他mysql连接信息(它使用 env('DB_DATABASE','forge')
获取信息)
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)
我可以使用 Migration
,但是当我使用函数 save()
$ 模型
:
I can use Migration
, but when I trying save register using function save()
of my Model
:
$newClient = new Client;
$newClient->name = "John";
$newClient->save();
会发生休假错误:
PDOException in Connector.php line 47:
could not find driver
================================================== ==============
For @ user3158900:
================================================================ For @user3158900:
我认为我的 PHP
已经安装了 MySQL
扩展,允许我的 phpinfo()
约 code>
I think my PHP
has MySQL
extension installed, fallowing my phpinfo()
about Mysql
>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]
推荐答案
如果您使用WAMP,您的网络服务器和命令行使用不同的php配置。
If you are using WAMP, your webserver and command line are using different php configurations.
请确保在配置文件或使用WAMP选项中启用pdo_mysql扩展。
Be sure to enable the pdo_mysql extension in both config files or using the WAMP options.
这篇关于Laravel:错误[PDOException]:无法在MySQL中找到驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!