[Help] PHP Postgres Running

I have installed php5, apache2 and postgresql supported on centos5
i try to connect to my database using pg_connect as

        $constr="host=localhost port=5432 dbname=$DataBaseName user=$UserName password=$UserPassword"; 
	$con = pg_connect($constr);

I can running through php(in shell mode) command is success(value of $con not false) but $con is aways return false with run through apache (open website).

Any one help me what is wrong

Does your script return any warnings when run with error_reporting(E_ALL); at the top? It sounds like the module is not loaded.

No anythings returned. :o

Oh i turned it off.
now I switch it on.
i got error

Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? in /home/user/public_html/testdb.php on line 2

My server already installed PostgreSQL server and open for accept port 5432 :cry: :cry:

But i edited my php code and remove host address and port and run again Success to connect Local database.

But My Objective try to connect another host any one can tell me please. :roll: :roll:

PS. My target host was config pg_hba.conf accept my host.
PS.II I test code in my PC was success connect to target host but this host still contain error. :cry: :cry: :cry: :cry:

could not connect to server: Permission denied

Is PostgreSQL configured to accept incoming connections from your machine on your username?

Sponsor our Newsletter | Privacy Policy | Terms of Service