Connection to sql server Error (trust_server_certificate)

hello @johnny

I am using Grocery CRUD Enterprise with Laravel 10 and need to set 'trust_server_certificate' => true for the database connection. However, I have configured it, but the error still persists.
return [
‘adapter’ => [
‘driver’ => ‘Pdo’,
‘dsn’ => ‘sqlsrv:server = tcp:’ . $databaseConfig[‘host’] . '; Database = ’ . $databaseConfig[‘database’],
‘database’ => $databaseConfig[‘database’],
‘username’ => $databaseConfig[‘username’],
‘password’ => $databaseConfig[‘password’],
‘options’ => [
‘trust_server_certificate’ => true,
],
],
];

Could you please guide me on how to resolve this?

Best regards,
Nasrul

hello @johnny

after debugging i solved my issue with this add trust_server_certificate on dsn options
like this
return [
‘adapter’ => [
‘driver’ => ‘Pdo’,
‘dsn’ => ‘sqlsrv:server = tcp:’ . $databaseConfig[‘host’] . ‘; Database = ’ . $databaseConfig[‘database’].’;TrustServerCertificate=1’,
‘database’ => $databaseConfig[‘database’],
‘username’ => $databaseConfig[‘username’],
‘password’ => $databaseConfig[‘password’],

        ],
    ];

best Regards
Nasrul