简体   繁体   English

无法更改 Laravel 查找 PostgreSQL SSL 证书的位置

[英]Can't change location that Laravel looks for PostgreSQL SSL certificate

I've installed pgsql and set up my Laravel config/database.php as follows:我已经安装了 pgsql 并设置了我的 Laravel config/database.php 如下:

'connection_name' => [
    'driver' => 'pgsql',
    'host' => env('DB_HOST_2', '127.0.0.1'),
    'port' => env('DB_PORT_2', '3306'),
    'database' => env('DB_DATABASE_2'),
    'username' => env('DB_USERNAME_2'),
    'password' => env('DB_PASSWORD_2', ''),
    'sslmode' => env('DB_SSLMODE_2'),
    'charset' => 'utf8',
    'prefix' => '',
    'options' => [
        'sslcert' => '/some/special/path.crt',
    ],
    'schema' => 'public',
],

'connection_name' is located in the 'connections' section of database.php . “connection_name”位于database.php的“connections”部分。

In artisan tinker I get the following error because it's still looking in the default location for the SSL certificate.在工匠修补程序中,我收到以下错误,因为它仍在寻找 SSL 证书的默认位置。 I cannot get it to look in the right location for the cert.我无法让它在正确的位置查找证书。

>>> use Illuminate\Support\Facades\DB;
>>> DB::connection('connection_name')->getPdo()
Doctrine\DBAL\Driver\PDOException with message 'SQLSTATE[08006] [7] root certificate file "/home/wes/.postgresql/root.crt" does not exist
Either provide the file or change sslmode to disable server certificate verification.'

The root cert is set by "sslrootcert".根证书由“sslrootcert”设置。 This is the certificate that signed the server's cert.这是签署服务器证书的证书。

"sslcert" sets the client cert. “sslcert”设置客户端证书。 That is something different.那是不同的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM