无法加载动态库'pdo_pgsql'无法连接到服务器:连接被拒绝(laravel部署)

问题描述 投票:0回答:1

我想在ubuntu服务器18 LTS中部署我的laravel应用。所以我已经安装了nginx postgres php。但是,当我尝试执行php artisan migrate时,出现此返回错误:

This is the errror (a picture beacose of comande line)

所以我已经验证了另一件事:首先,我可以使用postgres用户访问本地主机中的数据库。laravel应用程序无需数据库即可工作。

在php.ini中,我没有注释extention=pdo-pgsql;extention=pgsql

我已使用此命令sudo apt-get install php7.2-pgsql安装php postgres sql扩展名

这是我在laravel中数据库的.env设置:

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5433
DB_DATABASE=THERY //I have already create the database
DB_USERNAME=postgres
DB_PASSWORD=postgres

php laravel postgresql server webserver
1个回答
0
投票

您的问题可能有不同的问题。可能发生以下任何情况:

  1. 未安装php PGsql。通过
  2. 安装
apt-get install php-pgsql
  1. PGsql库在作曲家中丢失。通过
  2. 安装
composer require asmiarowski/laravel-postgres // There are multiple librariies available in packagist
  1. 您的.env中的配置未缓存。您可以通过运行命令来缓存它们]
php artisan config:cache
  1. 您的PGSql服务器无法访问。您可以采取进一步的措施来解决它们。
© www.soinside.com 2019 - 2024. All rights reserved.