使用XAMPP的Laravel迁移错误:[PDOException]找不到驱动程序 [英] Laravel migration error using XAMPP: [PDOException] could not find driver

查看:110
本文介绍了使用XAMPP的Laravel迁移错误:[PDOException]找不到驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了与此类似的一些问题,但是它们似乎主要针对的是与我所使用的环境不同的环境,所以我希望这不再重复.

I've seen a few similar questions to this one, but they seemed to be primarily addressing different environments than what I am using, so I hope this isn't a repeat.

我正在尝试在Windows 7上使用XAMPP在本地服务器上的Laravel 4.2中进行测试迁移.当我尝试运行php artisan migrate时,出现错误:

I am trying to do a test migration in Laravel 4.2 on my local server using XAMPP on Windows 7. When I try to run php artisan migrate, I get the error:

  [PDOException]
  could not find driver



migrate [--bench[="..."]] [--database[="..."]] [--force] [--path[="..."]] [--pac
kage[="..."]] [--pretend] [--seed]

我看到的大多数其他建议都是关于php.ini文件的,但是我确实有必要的注释:

Most other suggestions I've seen are in regards to the php.ini file, but I do have the necessary line uncommented:

extension=php_pdo_mysql.dll

当我查看我的phpinfo()时,它似乎正在运行:

And it appears to be running when I view my phpinfo():

                 mysqlnd
...
API Extensions          mysql,mysqli,pdo_mysql


                 pdo_mysql
PDO Driver for MySQL    enabled
Client API version      mysqlnd 5.0.11-dev - 20120503 - $Id: 
                        bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $

我唯一的想法是在端口81和3307而不是默认的80和3306上运行XAMPP可能是一个问题(尽管我相信我确实正确配置了XAMPP的配置文件,因为我已经能够运行这些端口上的其他应用程序正常).还有其他我可能会错过的Laravel配置文件吗?

My only thought is that it might be an issue with my running XAMPP on ports 81 and 3307 instead of the default 80 and 3306 (although I believe I do have XAMPP's config files correctly configured, since I've been able to run other applications fine on these ports). Are there any other Laravel config files I might have missed though?

编辑11/15 我看到在此处中也有类似的问题,但值得的是,该用户的错误是在安装过程 之后发生的(它似乎是通过Laravel而不是通过php.ini文件解决的).这个特定的问题似乎与安装过程本身有关,并且似乎对至少少数在其他版本的问题中找不到特定答案的人有所帮助.

Edit 11/15 I see that there was a similar question asked here, but for what it's worth it appears that that error for that user had occurred after the installation process (it appeared to have been resolved through Laravel instead of through the php.ini file). This specific problem appears to have been related to the installation process itself, and appears to have help at least a few people that also were unable to find the specific answer in other versions of the question.

推荐答案

发生这种情况可能有多种原因. 未设置默认数据库类型(config/database.php), 或未启用扩展, 或者您已经启用了扩展程序但尚未重新启动XAMPP, 或环境设置下的PATH设置未正确定义.

This can happen for a Number of reasons. Either the Default DB type is not set (config/database.php), or the Extension is not enabled, or you HAVE enabled the extension but have NOT restarted XAMPP, or the PATH settings under environment settings are not properly defined.

我建议您检查出可能解决此问题的答案: https://stackoverflow.com/a/25336292/2745485

I suggest you check out this answer which may solve the issue: https://stackoverflow.com/a/25336292/2745485

致谢.

这篇关于使用XAMPP的Laravel迁移错误:[PDOException]找不到驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆