Open yuan8 opened 2 years ago
If you are using Laravel Sail and your pgsql service is running in a Docker container then you should remove the port from your 'host' string eg:
'database' => [
'driver' => 'pgsql'),
'host' => env('DB_HOST'),
'database' => env('DB_DATABASE'),
...
Sail references the different containers in docker with aliases (Actually I think it might be Docker that does this) and you won't need to include the port like you would when pointing directly to a server hosting the service.
With pgsql you will probably also have trouble with the SET NAMES command in: vendor/hansschouten/phpagebuilder/src/Core/DB.php
as it looks like pgsql likes the charset value enclosed in single quotes.
WARNING!: The below is a quick fix to get things working for development - when you update your laravel-pagebuilder package it will overwrite the below change to line 34. So do this if you need to get up and running in dev but hopefully a permanent fix will be implemented in the package sometime.
Change line 34 to:
$this->pdo->exec("SET NAMES '" . $config['charset'] . "'");
SQLSTATE[08006] [7] could not translate host name "127.0.0.1:5432" to address: nodename nor servname provided, or not known