exception 'PDOException' with message 'could not find driver' SQLSRV Laravel Artisan CLI

前端 未结 2 669
挽巷
挽巷 2021-01-03 01:54

I am running php 5.5 on a Windows Server 2008. I am using the Laravel 4.0 framework for the application. I am connecting to a SQL SRV database via PDO, when executed via htt

相关标签:
2条回答
  • 2021-01-03 02:29

    php cli and php cgi use different php.ini files. Try php -i | grep pdo to see if pdo is installed for your cli, see php -i | grep "Loaded Configuration File"

    0 讨论(0)
  • 2021-01-03 02:43

    The answer above is correct, but just to clarify:

    1. Open your console and execute:

      php -i | grep "Loaded Configuration File"

    2. That will give you the folder directory where you php-cli.ini is (Laravel Commands use a different php.ini than the one used by HTTP requests)

    3. Go to that file, and make sure it has this:

      extension=php_pdo_mysql.dll

    4. Restart your server and try again. That worked for me, hope it helps.

    0 讨论(0)
提交回复
热议问题