Connect Laravel to SQL Server

TLDR; Download Drivers, Copy to ext, Add to php.ini, Config .env and set port to null

Photo by Banter Snaps on Unsplash
  1. Install SQL Server and select “SQL Server and Windows Authentication mode”, setup a user and password to login.
  2. Download SQL Server PHP Drivers
  3. Extract drivers on ext directory inside your php installation directory
  4. Add the following to your php.ini file (tweak your php version and change nts (non-thread safe) or ts (thread safe) accordingly)
extension=php_sqlsrv_73_nts_x64.dll
extension=php_pdo_sqlsrv_73_nts_x64.dll

5. Update your .env file with the database connection details

DB_CONNECTION=sqlsrv
DB_HOST="DESKTOP-ABC3XX2\SQL2014"
DB_PORT=null 
DB_DATABASE=forge # Remember to create the database before
DB_USERNAME=sa
DB_PASSWORD=secret