我想從php
連接到遠程數據庫postgres
,但它無法連接並說PHP pgAdmin的遠程數據庫連接失敗
Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server:
could not connect to server: No route to host (0x00002751/10065) Is the server running on host "xxxxxxxxx" and accepting TCP/IP connections on port 5432? in C:\xampp\htdocs\test.php on line 4
Wrong CONN_STRING
<html>
<body>
<?php
$db = pg_connect('host=xxx.xxx.xxx.xxx port=5432 dbname=postgres user=postgres password=') or die('Wrong CONN_STRING');
if (!$db) {
echo 'error';
}else{
echo 'success';
}
?>
</body>
同一數據庫,我可以從運行pgadmin
客戶端訪問在Apache運行的同一臺機器上,我不明白,pgadmin可以訪問數據庫,但Apache Web服務器的PHP無法訪問?任何想法 ?
我也試過,但不工作 http://www.ehow.com/how_2090983_connect-remote -database-下selinux.html – 2011-02-24 07:29:11