473,786 Members | 2,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("dbn ame=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 1777
um********@nets cape.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("dbn ame=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********@nets cape.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********@nets cape.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.derekfounta in.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
5485
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 is unlimited, and so is max_persistent. It's got to be something obvious - but I can't see it.
6
3807
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 one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
1
2788
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 example: $conn=pg_connect("host=142.1240.123.10 port=3452 dbname=datbase user=mi password=pwd") thanks, regards
2
2399
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$"); phpinfo(); ?>
6
51580
diamond1
by: diamond1 | last post by:
Hi: How can solve this problem: Fatal error: Call to undefined function pg_connect() Thanks in advance
2
1556
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 into 4 parts and am still having trouble uploading it. What am I doing wrong?
0
1750
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 anyone tell me what the problem is? Regards susikta
2
26384
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.... I also want to tell that: I am setting up virtual host on my computer, apache works for projects that don't have database support. I uncomment php.ini file for postgres. Apache runs fine there is no error.
0
1676
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 glitches in the massive, complex machines they use to smash atoms.
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10169
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.