'Laravel: The certificate chain was issued by an authority that is not trusted
Here's the complete error message:
SQLSTATE[08001]: [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted.
I've a private company project, currently the project is developed using CodeIgniter3 and the database uses Microsoft SQL Server. I need to turn the project into Laravel9. So, I follow several instruction until meet some tutorial here:
- Laravel migration cannot find driver when using sqlsrv database in windows (the last answer seems suitable to my problem)
- https://www.microsoft.com/en-us/download/details.aspx?id=20098 (here's the driver for PHP7, but my project uses PHP8.0 so, I download the other file)
The installation didn't face much problem. I follow the procedure from the first list with the suitable driver. But then facing the error as mentioned above.
Solution 1:[1]
i found the solution here: Laravel SQL Server connection with ENCRYPT=yes trustServerCertificate=true
it also working for laravel 9, update the config file config/database.php like below
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'encrypt' => 'yes',
'trust_server_certificate' => true,
],
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
