|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP 4.2.2 & Postgresql 7.3.2 Connection Problem
Can't seem to get PHP and pgsql to connect. I get this error:
Warning: pg_connect() unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host localhost and accepting TCP/IP connections on port 5432? in /var/www/html/photo_contest.php on line 2 I looked for pg_hba.conf but can't find the file. Please Help! Thanks |
|
#2
|
|||
|
|||
|
Generally you don't need to modify pg_hba.conf if PHP is running on the same machine as PostgreSQL. You just need to make sure that the PostgreSQL daemon is started with the -i option, as in "pg_ctl -start -o -i " etc...
But anyway, pg_hba.conf is usually in the PostgreSQL "data" folder, sometimes at /usr/local/pgsql/data, but it really depends on the system. The real question is whether PostgreSQL really is running. Have you successfully connected from PHP in the past on this server? Do the following command: "ps ax | grep postmaster" and post your results here (if you are running Linux; if you are running FreeBSD or some other Unix, it is probably "ps -ax | grep postmaster").
__________________
The real n-tier system: FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL Amazon wishlist -- rycamor (at) gmail.com |
|
#3
|
|||
|
|||
|
No, I haven't connected successfully. I just got a project and they need me to build the database in postgre. I've never worked with it before.
The Results: -bash-2.05b$ ps ax | grep postmaster 1837 ? S 0:00 /usr/bin/postmaster -p 5432 2204 pts/0 R 0:00 grep postmaster Thanks |
|
#4
|
|||
|
|||
|
had the same problem recently
just remove the host= from the connection string and you'll be fine. It's most likely localhost, you don't need that string anyway. Once I removed the host= the error didn't come back.
|
![]() |
| Viewing: Dev Shed Forums > Databases > PostgreSQL Help > PHP 4.2.2 & Postgresql 7.3.2 Connection Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|