I am working on a Laravel 5.1 project that should connect to an existing MS SQL Server database. My project is currently hosted on an Ubuntu 16.04 LTS server using Apache 2.4.18. I installed the Microsoft ODBC Linux driver for SQL Server (version 13.0.0.0) on the machine and checked it manually using the sqlcmd command:
sqlcmd -S DatabaseIPAddress -U DatabaseUsername
Everything worked fine. I can not enter the database without problems. However, when I proceed to migrate my database using php artisan, it does not work. I get an error message:
[PDOException] could not find driver
I have this as a setup in database.php:
'sqlsrv' => [ 'driver' => 'sqlsrv', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', ],
Information for entering the database is saved in the .env file, and SQL Server is installed by default:
'default' => env('DB_CONNECTION', 'sqlsrv'),
Any help regarding what might be happening? I read a bunch of posts on the Internet ( here and here ). People had problems with various types of databases. They had to change the configuration of their php.ini file by adding some lines about the extensions. Maybe something like that? I tried some different things in the php.ini file that I thought might work, for example:
rebooted, tested, but to no avail. For a while I hit my head against the wall. Any help would be greatly appreciated. Thanks.