0

I am trying to build a artisan command that will connect to a remote MSSQL server, retrieve some records and store them in the local MySQL db.

The query I am performing is DB::connection('sqlsrv')->select('SELECT * FROM Users')

If I use the above in a blade view, it works. But if I use it in an artisan command, I get the error [PDOException] could not find driver

Any help appreciated

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
darronz
  • 903
  • 9
  • 17
  • Make sure your terminal PHP has the correct PDO drivers enabled. You can use a different `php.ini` for both web and CLI PHP. Use `php --ini` to see where the `php.ini` file is stored. – Jason Lewis May 10 '13 at 14:13
  • Hi Jason, thanks for the suggestion. Checked to see what ini file it is loading and it looks like it is the same for cli and web. I found a few articles about it. [This one](http://blog.nguyenvq.com/2013/04/06/guide-to-accessing-ms-sql-server-and-mysql-server-on-mac-os-x/) was helpful as it described testing from the cli using `isql` which I was successful, so it can be done from the cli... just not sure how all the pieces fit together – darronz May 13 '13 at 08:24

0 Answers0