473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

trouble with pg_connect

Hi,

I'm having some troubles getting pg_connect() to connect over UNIX
domain sockets. Something that really confuses me is the error string
being served up by apache. It says it was unable to connect to
database xxxx. However, the characters are gibberrish. At first I
thought that my problem was that I forgot to give the user name also
(seeing there was no apache user in postgresql). However that wasn't
it. To make sure though, I added an apache username to the postgresql
server.

Currently, my pg_connect looks like this:

$dbconn = pg_connect("dbname=mydb user=andy");
I have checked the pg_hba.conf file, but that shouldn't be it as I can
connect via psql over UNIX domain. However, given my current
predicament, I'd like any and all suggestions.

Andt

Jul 17 '05 #1
3 1755
um********@netscape.net wrote:
Hi,

I'm having some troubles getting pg_connect() to connect over UNIX
domain sockets. Something that really confuses me is the error string
being served up by apache. It says it was unable to connect to
database xxxx. However, the characters are gibberrish. At first I
thought that my problem was that I forgot to give the user name also
(seeing there was no apache user in postgresql). However that wasn't
it. To make sure though, I added an apache username to the postgresql
server.

Currently, my pg_connect looks like this:

$dbconn = pg_connect("dbname=mydb user=andy");
I have checked the pg_hba.conf file, but that shouldn't be it as I can
connect via psql over UNIX domain. However, given my current
predicament, I'd like any and all suggestions.

Andt

is postgres support compiled/loaded into your php. Check phpinfo()...

Steve
Jul 17 '05 #2
um********@netscape.net writes:
Hi,

I'm having some troubles getting pg_connect() to connect over UNIX
domain sockets. Something that really confuses me is the error string
being served up by apache. It says it was unable to connect to
database xxxx. However, the characters are gibberrish. At first I


Never had this problem.

Food for thought; are you still running the same version of Postgres
that your PHP module was built against?

--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile http://www.JerrySievers.com/
Jul 17 '05 #3
um********@netscape.net wrote:
I'm having some troubles getting pg_connect() to connect over UNIX
domain sockets. Something that really confuses me is the error string
being served up by apache. It says it was unable to connect to
database xxxx. However, the characters are gibberrish.


The fact that you have gibberish characters in the error string is a red
herring. I saw that when connecting over TCP/IP using "host=localhost". I
took that host parameter out so it used UNIX sockets and it continued to
give error messages like you're getting. I was as bewildered as you are.

I never did work it out. PostgreSQL security seems horribly complex. I got
around the problem by turning the security off. I deleted all the default
entries from /var/lib/pgsql/data/pg_hba.conf and added this line instead:

local all all trust

which at least allowed me to get on with my project. I can't recommend it as
a sensible solution though. Guys like us need to learn how to do this stuff
properly!

--
The email address used to post is a spam pit. Contact me at
http://www.derekfountain.org : <a
href="http://www.derekfountain.org/">Derek Fountain</a>
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James Ward | last post by:
Hi all, I've searched high and low on the web and the group for the following error: pg_connect(): Cannot create new link. Too many open links (0) I have checked phpinfo and it says max_links...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
1
by: Chifo | last post by:
I try to connect postgres database but browser showme a error"Fatal error undefined funtion pg_connect()" somebody can helpme ? i dont know whats means, all conection string its ok this is an...
2
by: John Oliver | last post by:
Fedora Core 2, httpd-2.0.54-10.2, php-4.3.10-2.4, postgresql-7.4.7-3.FC2.1 Using a test.php that includes: <?php pg_connect("host=localhost dbname=db_name user=user password=password$");...
6
diamond1
by: diamond1 | last post by:
Hi: How can solve this problem: Fatal error: Call to undefined function pg_connect() Thanks in advance
2
by: JLupear | last post by:
I am having trouble with my code again, I had prepared a question and the code to upload, however I am having trouble posting it, are there limits to the amount of lines you can post? I split it...
0
by: susikto | last post by:
hi, I am getting this error when I am trying to connect the PSQL database. PHP Warning: pg_connect() : Unable to connect to PostgreSQL server: FATAL: user &quot;apache&quot; does not exist Can...
2
by: creative1 | last post by:
I get following error: Fatal error: Call to undefined function pg_connect() in C:\www\desiorb.dev\public_html\httpdocs\index.php on line 18 said line is to connect to postres pg_Connect.... ...
0
by: mrchatgroup | last post by:
news from http://www.mrchat.net/myblog/myblog/small-accidents-mean-big-trouble-for-supercollider.html Small Accidents Mean Big Trouble for Supercollider Image Scientists expect startup...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.