The PHP manual's entry on [man]pg_connect/man states: "Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \."
Now, pg_escape_string() performs the usual SQL string escaping, i.e., it escapes single quotes by doubling them. What you want to use instead, is [man]addslashes/man, e.g.,
$conn_str = "host='" . addslashes($host)
. "' user='" . addslashes($user)
. "' password='" . addslashes($password)
. "' dbname='" . addslashes($database) . "'";
$this->handler = pg_pconnect($conn_str);