docs icon indicating copy to clipboard operation
docs copied to clipboard

Postgresql socket configuration is undocumented, confusing

Open melissaboiko opened this issue 4 years ago • 1 comments

Current install docs say:

  • Set DB_HOST to the IP of the machine
  • Set DB_PORT to the port on which your database server is exposed

Alternatively, if you are using a Unix socket:

  • Set DB_SOCKET to the path of the socket, e.g. /run/mysqld/mysqld.sock

But this doesn't work for Postgresql. The only way I could make it work was:

DB_CONNECTION=pgsql
# DB_SOCKET=/run/postgresql/
DB_HOST=/run/postgresql/
DB_PASSWORD=null
DB_PORT=5432 # ?

DB_DATABASE=pixelfed
DB_USERNAME=pixelfed

melissaboiko avatar Aug 25 '21 13:08 melissaboiko

This seems to be the standard way to do it, though the DB_PORT should be empty then.

See https://github.com/laravel/framework/blob/f21afbcd52067a3cd9ff249b42800058e4bfcc73/config/database.php#L85

An example of compatible doctrine PDO driver : https://github.com/cedricziel/doctrine-driver-pdo-pgsql/blob/35d0eeb7d18e2363c9606a5d8ec77384f5063b62/PgSQLSocketDriver.php#L66C30-L66C41

Murazaki avatar Feb 13 '25 21:02 Murazaki