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

时间:2019-10-08 21:13:37

标签: php laravel postgresql ssl

我已经安装了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”位于database.php的“ connections”部分。

在工匠修补匠中,我收到以下错误消息,因为它仍在SSL证书的默认位置中查找。我无法让它找到证书的正确位置。

>>> 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.'

1 个答案:

答案 0 :(得分:0)

根证书由“ sslrootcert”设置。这是签署服务器证书的证书。

“ sslcert”设置客户端证书。那是不同的。