Connection to Microsoft SQL fails after update from ODBC 17 to 18

Mohammad Zaeri Amirani 31 Reputation points
2022-10-31T09:32:23.717+00:00

Hi.
I have upgrade our Laravel App on Azure from 8 to 9 and therefor was need to update PHP 7.4 to 8.x .
It began to work very well, but now i can consider a error on connection to one other MS sql server. Laravel app used 2 DB connections, one to a Azure SQL server, which connection to it works very well. But Laravel App has a connection to other MS SQL on promise server, which connection to it doesn't work.
AS I can see from this document:
https://techcommunity.microsoft.com/t5/sql-server-blog/odbc-driver-18-0-for-sql-server-released/ba-p/3169228

It is because: ODBC Driver 18 for SQL Server and JDBC Driver 10.2 for SQL Server both default to the Encrypt=yes;
I tried to set TrustServerCertificate=true; and TrustServerCertificate=yes in config/databse.php file, but neither of them work.
But both of them works very well in a simple php script. Why?
How should I add TrustServerCertificate parameter to LAravel App to could connect to this on-promise server SQL database?
Many thanks in advance

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,220 questions
{count} votes