【发布时间】:2020-08-07 13:47:15
【问题描述】:
我在 nginx 上有一个带有 postresql 的 laravel 应用
php artisan migrate
抛出错误:
In Connection.php line 671:
SQLSTATE[08006] [7] received invalid response to SSL negotiation: b (SQL: select * from information_schema.tables where table_schema = publ
ic and table_name = migrations and table_type = 'BASE TABLE')
In Connector.php line 70:
SQLSTATE[08006] [7] received invalid response to SSL negotiation: b
文件:
.env
...
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=secretdbname
DB_USERNAME=secretusername
DB_PASSWORD=secretpassword
...
postresql.conf ...
port = 5432
...
在 php.ini 中启用:
pgsql
pdo_pgsql
mbstring
php -m
...
mbstring
openssl
PDO
pdo_mysql
pdo_pgsql
pgsql
...
存在相应的数据库,用户存在并获得所有权限。 Postgres 服务处于活动状态。 数据库和应用程序位于同一台服务器上。
我尝试过的:
- 在 .env 和 postgres.conf 中设置不同的端口
- 使用不同的数据库、用户和密码进行测试
- 重新启动 postresql
- 在修补程序 DB::connection()->getPdo();抛出同样的错误
- 在 DB_HOST 中尝试了 127.0.0.1。而不是本地主机
- 在 config/database.php 我尝试将 'sslmode' 设置为 'disable'
我有 certbot 的 SSL 证书。
我将不胜感激有关如何解决上述错误的提示。
【问题讨论】:
-
请尝试
php artisan config:cache,然后再次运行。在 tinker 中,测试一些配置值,例如env("DB_HOST")或env("DB_PORT")。
标签: laravel postgresql ssl migrate