{{tag>databases postgres postgresql}}

====== PHP Client ======

<code php>
<?php
$connection = pg_connect("host=host.docker.internal dbname=postgres user=postgres password=postgres serverVersion=13 charset=utf8 options='--client_encoding=UTF8'");
if ($connection) {
    echo "connected\n";

    $res = @pg_query($connection, 'SELECT * FROM pg_catalog.pg_tables;');
    if ($res) {
        echo "OK\n";
    } else {
        echo "ERR\n";
    }

} else {
    echo "there has been an error connecting\n";
}
</code>

====== Postgresql ======

{{topic>[postgresql]}}