Laravel Migration Error :: PDOException, Could not

2019-03-06 10:39发布

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.

enter image description here

enter image description here

What i sthis issue, How can i solve this,

I am using Xampp.

Anybody please help me.

Thanks

2条回答
ら.Afraid
2楼-- · 2019-03-06 11:19

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.

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
查看更多
你好瞎i
3楼-- · 2019-03-06 11:38

Try re-installing Xampp? You could use Laravel homestead for a virtual machine, it makes sure you have the proper PHP version and the required dependencies needed to install and avoids having to run Xampp or MAMP or WAMP or any of the amps.

It looks like Xampp cannot find: /usr/lib/php5/20121212/php_pdo_mysql.dll, so make sure that file exists.

You may need to re-install PHP PDO on your machine, refer to: http://php.net/manual/en/pdo.installation.php

Also per PHP docs:

PDO and all the major drivers ship with PHP as shared extensions, and simply need to be activated by editing the php.ini file:

extension=php_pdo.dll

查看更多
登录 后发表回答