PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 22nd, 2004, 10:58 PM
DjSatuRn DjSatuRn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 13 DjSatuRn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 49 m 31 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old July 23rd, 2004, 12:22 AM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,300 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 3 h 12 m 27 sec
Reputation Power: 56
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

Reply With Quote
  #3  
Old July 23rd, 2004, 01:27 AM
DjSatuRn DjSatuRn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 13 DjSatuRn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 49 m 31 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old July 23rd, 2004, 04:35 PM
vivehosting.com vivehosting.com is offline
PHP Guru
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: New York
Posts: 15 vivehosting.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 57 sec
Reputation Power: 0
Send a message via ICQ to vivehosting.com Send a message via AIM to vivehosting.com Send a message via MSN to vivehosting.com Send a message via Yahoo to vivehosting.com
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > PHP 4.2.2 & Postgresql 7.3.2 Connection Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT