Have you checked php extension: the sqlsrv and pdo_sqlsrv module ?
Make sure the sqlsrv module is loaded before pdo_sqlsrv.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have been gooling for days, but I am still unable to get laravel connected to sql server. I followed what ppl in stackoverflow and laracast say, but it's still not successful What I did so far was
DB_CONNECTION=sqlsrv
DB_HOST=WINDOWS7\SQLSRV
DB_PORT=1433
DB_DATABASE=dblaravel
DB_USERNAME=myusername
DB_PASSWORD=my@password
'default' => env('DB_CONNECTION', 'sqlsrv'),
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
but still get this error
In Connection.php line 664:
SQLSTATE[28000]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'myusername'. (SQL: select * fr
om sysobjects where type = 'U' and name = migrations)
In Connector.php line 67:
SQLSTATE[28000]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'myusername'.
I have changed TCP/IP Dynamic port to 1433 and restart in SQL Server Configuration Manager, but still get error.
What could probably wrong?I am new to sql server
The authentication I am using in sql management studio is windows7 and the mode is Windows and SQL
Please or to participate in this conversation.