<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
if ($pgsql_conn) {
pg_trace('/tmp/trace.log', 'w', $pgsql_conn);
pg_query("SELECT 1");
pg_untrace($pgsql_conn);
// Now /tmp/trace.log will contain backend communication
} else {
print pg_last_error($pgsql_conn);
exit;
}
?>