Accessing Postgres via PHP


Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? in /home/staff/acad/in9352/public_html/db/pgExample.php on line 42

Fatal error: Uncaught TypeError: pg_exec(): Argument #1 ($connection) must be of type PgSql\Connection, bool given in /home/staff/acad/in9352/public_html/db/pgExample.php:9 Stack trace: #0 /home/staff/acad/in9352/public_html/db/pgExample.php(9): pg_exec() #1 /home/staff/acad/in9352/public_html/db/pgExample.php(45): select_data() #2 {main} thrown in /home/staff/acad/in9352/public_html/db/pgExample.php on line 9