Laravel迁移错误:: PDOException,找不到驱动程序 [英] Laravel Migration Error :: PDOException, Could not find driver
问题描述
在迁移时,我试图制作一只幼虫并卡住.当我输入php artisan在终端中迁移时,显示PDOException错误.附上我的终端和phpinfo的屏幕截图.
I am trying to make a laravel and stucked when migration. when i enter php artisan migrate in terminal, showing PDOException error. attaching my screenshot of terminal and phpinfo.
这个问题,我该如何解决,
What i sthis issue, How can i solve this,
我正在使用Xampp.
I am using Xampp.
任何人都可以帮助我.
Anybody please help me.
谢谢
推荐答案
请检查您是否在系统中安装了多个php版本,其中一个正在为Web服务器运行,另一个正在为php CLI运行,并且对Web和php使用PHP_INFO- -ini在命令行中,如果找到了不同的版本,则升级或降级意味着将其配置为一个版本,并确保在系统中启用了PDO.
Please check you have installed more than one php version in your system, one is running for web server and another for php CLI, using PHP_INFO for web and php --ini in commandline, if different version found then upgrade or downgrade means make it one version configuration, and make sure PDO is enable in your system.
从php5.6到php7.0:
From php5.6 to php7.0:
Apache:
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php7.0
From php7.0 to php5.6:
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6
这篇关于Laravel迁移错误:: PDOException,找不到驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!