【php】Laravel SQLSTATE[08001]: [Microsoft][ODBC Driver 18 for SQL Server]SSL 提供程序: 证书链是由不受信任的颁发机构颁发的
laravel + sqlserver部署环境时,出现以下报错:
Laravel SQLSTATE[08001]: [Microsoft][ODBC Driver 18 for SQL Server]SSL 提供程序: 证书链是由不受信任的颁发机构颁发的。 (SQL: select [value], [key] from [setting] where [type] = system)
/config/database.php
添加 ‘trust_server_certificate’=>true,
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'trust_server_certificate'=>true,
],