I want to deploy my laravel app in ubuntu server 18 LTS. So I have install nginx postgres php. But when i try to do php artisan migrate
I have this returned error :
This is the errror (a picture beacose of comande line) .
So I have verify different thing : First I can access to my data base in localhost with the postgres user. The laravel app work while database not be required.
In php.ini I have uncomment extention=pdo-pgsql;
and extention=pgsql
I have install the php postgres sql extension with this command sudo apt-get install php7.2-pgsql
And this is my .env settings for database in laravel :
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
So for my problem they have two solution plus a bonus
sudo apt-get --purge remove php-common
sudo apt-get install php-common php-pgsql php-cli
#php install comande
sudo apt-get install php-fpm openssl php-common php-curl php-json php-mbstring php-xml php-zip php-pgsql
#make sure to uncomment extension=pdo_pgsql
sudo nano /etc/php/7.2/fpm/php.ini
#restart fpm service to apply settings
sudo systemctl restar php7.2-fpm
Finally if you have an [SQLSTATE 08006 error] check if the port in .env file in your laravel app correspond to the listened port in your server (form me the used port is 5432 and not 5433)