Mar 12, 2024
0
Level 1
Laravel application on WSL not connecting to host Microsoft SQL Server
I am trying to connect to a Microsoft SQL Server running on the Windows Host from my Laravel application on WSL2. I have installed the drivers for PHP and SQL Server on WSL2, but I get the following error on trying to access the database:
SQLSTATE[HYT00]: [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (Connection: sqlsrv, SQL: select top 1 1 [exists] from [users] where [email] =*****
My .env file configuration is as follows:
DB_CONNECTION=sqlsrv
DB_HOST=localhost
DB_PORT=1433
DB_DATABASE=services
DB_USERNAME=*********
DB_PASSWORD=**********
I have masked username and password. I suspect the issue is to do with IP addresses.
Please or to participate in this conversation.