Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mosbi's avatar
Level 1

query problem on SQLSERVER database with laravel

Hello community! I work with Laravel 5.5.44 a long time ago with a database Mysql! All went well: I manage to make requests for insertion, update, reading on my database! At the time of deploying my application in company, it turns out that I three necessarily use SQLSERVER like database! So I tried to see how migrated my database from Myqsl to SQLSERVER: successful thing! I migrated my database, I also made the creation of login login to SQL Management Studio, I also create a database user. After all these actions, I disconnect from SQL Management Studio, and reconnect using the new user I just created and not "his"! With the SQL Management Studio Queryer, I list the information from my database and all works as normal! My problem now is that when I entered the information in my ".env" file to connect to my database on SQLSERVER: DB_Connection = sqlsrv DESKTOP = DB_HOST-OUUVQUE \ SQLEXPRESS DB_PORT = 1433 DB_DATABASE = bssnavette DB_USERNAME = bssnavette DB_PASSWORD = '1234' no more requests function! I notice that in my controller, at the level of my queries I can not get to my tables anymore: Status Code: 500 Internal Server Error While I test my connection to the database SQLSERVER by typing the command: php artisan migrate: by mistake! Could anyone tell me where I have failed to settle? Thank you

0 likes
4 replies
lostdreamer_nl's avatar

" Status Code: 500 Internal Server Error"

This could be anything, but my guess is a missing SQL Server driver.

Check your storage/logs/laravel.log for the actual error. If your log is too full, delete it and try to run the migration again. After you get the error, check the log file and post the exception (including the stack trace) here.

Also, try to put it between

```

Log goes here
so it is

more readable

```

mosbi's avatar
Level 1

I erase the contents of the laravel.log file then i retype the command php artisan migrate but nothing happened in the log file! When I say that I can not connect to the sqlserver database, I say: in my laravel application, I have a php script that queries the database and displays the row count of one of the tables! I do this using Ajax: and when I connect to the sqlserver database, I can not display the row number of the table anymore! When I look in the console of my browser I see the line: GET http://navette.bissa.com/StatisticsReservationBissaOuagaTreatment 500 (Internal Server Error)

lostdreamer_nl's avatar

After that 500, you should either have a stack trace in storage/logs/laravel.log or perhaps it's somewhere higher up in the webserver, in which case you'd need to check either

  • /var/log/apache/error.log (maybe different path / filename)
  • /var/log/nginx/error.log (maybe different path / filename)
mosbi's avatar
Level 1

Yes this line in the apache access log:

navette.bissa.com - - [28/Nov/2018:00:31:42 +0000] "GET /StatistiqueReservationBissaOuagaTraitement HTTP/1.1" 500 - navette.bissa.com - - [28/Nov/2018:00:31:44 +0000] "GET /StatistiqueReservationBissaOuagaTraitement HTTP/1.1" 500 -

Please or to participate in this conversation.