Setting up Laravel with SQL Server AND Laragon on Windows

I simply need to share how I join my laravel undertaking with sqlserver.

I assume that you have already got Laragon and SQL Server in your native system.

Step 1. Obtain the PHP driver here

  • Go to the underside of the web page then obtain windows-8.1.zip (since I am utilizing PHP 8.1
  • Extract the zip file to a folder, then go to folder named x64, you will notice the next dll
    Image description
  • Then copy these dll to your php folder contained in the laragon folder, mine is C:laragonbinphpphp-8.1.5-nts-Win32-vs16-x64ext
    Image description
  • Then Edit your php.ini, add the extension
    Image description
  • Then restart your laragon server

Step 2. Make a brand new laravel app utilizing laragon fast app menu
Image description
Image description

  • Then we have to replace the .env file
DB_CONNECTION=sqlsrv
DB_HOST=127.0.0.1
DB_PORT=1433
DB_DATABASE=lara-sqlserver
DB_USERNAME= sa
DB_PASSWORD= 12345678 
Enter fullscreen mode

Exit fullscreen mode

  • Subsequent, create the database in sql administration studio, mine is lara-sqlserver
  • Earlier than working the migration, make sure that to allow tcp-ip in sql configuration supervisor
    Image description

  • then run the migration

     php artisan migrate
Enter fullscreen mode

Exit fullscreen mode

  • if every little thing works wonderful it is best to see this in your terminal
    Image description

Thanks guys!

Add a Comment

Your email address will not be published. Required fields are marked *