DEV Community


Posted on


Setting up Laravel with SQL Server AND Laragon on Windows

I just want to share how I connect my laravel project with sqlserver.

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

Step 1. Download the PHP driver here

  • Go to the bottom of the page then download (since I'm using PHP 8.1 Image description
  • Extract the zip file to a folder, then go to folder named x64, you will see the following dll Image description
  • Then copy these dll to your php folder inside the laragon folder, mine is C:\laragon\bin\php\php-8.1.5-nts-Win32-vs16-x64\ext Image description
  • Then Edit your php.ini, add the extension Image description
  • Then restart your laragon server

Step 2. Make a new laravel app using laragon quick app menu
Image description
Image description

  • Then we need to update the .env file
DB_PASSWORD= 12345678 
Enter fullscreen mode Exit fullscreen mode
  • Next, create the database in sql management studio, mine is lara-sqlserver
  • Before running the migration, make sure to enable tcp-ip in sql configuration manager
    Image description

  • then run the migration

     php artisan migrate
Enter fullscreen mode Exit fullscreen mode
  • if everything works fine you should see this in your terminal Image description

Thanks guys!

Top comments (0)

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<