Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link resource in /usr/local/lib/pear/DB/pgsql.php on line 410
是不是没有连接上呀 
但是我用 
<?php
require_once 'DB.php';$dsn = array(
'phptype' => 'pgsql',
'username' => 'xxxxxxxx',
'password' => 'xxxxxxxxxx',
'hostspec' => 'xxxx.xxxx.xxxx',
'database' => 'xxxxx',
'port' => '5433'
);$options = array(
'debug' => 2,
'portability' => DB_PORTABILITY_ALL,
);$db =& new DB;
$conn=$db->connect($dsn, $options);
if (PEAR::isError($db)) {
die($db->getMessage());
}else{echo 'dbconnect ok';}
>
测试成功 !

解决方案 »

  1.   

    /usr/local/lib/pear/DB/pgsql.php是pear的源文件,
    根据错误产生的可以推测:
    1 要么没有正确的连接。
      检查一下$dsn参数。
    2 要么pear本身有问题。
      

  2.   

    我测试的时候 dns 是一样的
    $dsn = array( 
    'phptype' => 'pgsql', 
    'username' => 'xxxxxxxx', 
    'password' => 'xxxxxxxxxx', 
    'hostspec' => 'xxxx.xxxx.xxxx', 
    'database' => 'xxxxx', 
    'port' => '5433' 
    ); Pear本身的问题 怎么测呢?