Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 14, 2022 04:26 pm GMT

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 windows-8.1.zip (since I'm using PHP 8.1Image 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\extImage description
  • Then Edit your php.ini, add the extensionImage 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_CONNECTION=sqlsrvDB_HOST=127.0.0.1DB_PORT=1433DB_DATABASE=lara-sqlserverDB_USERNAME= saDB_PASSWORD= 12345678 
  • 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
  • if everything works fine you should see this in your terminal Image description

Thanks guys!


Original Link: https://dev.to/retinqdon/setting-up-laravel-with-sql-server-and-laragon-on-windows-2cp9

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To