Skip site navigation (1) Skip section navigation (2)

Re: DB Error: connect failed

From: Andy Shellam <andy(dot)shellam-lists(at)mailnetwork(dot)co(dot)uk>
To: Fatih Gulec <fatihg(at)cs(dot)hacettepe(dot)edu(dot)tr>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: DB Error: connect failed
Date: 2006-08-14 18:06:00
Message-ID: 44E0BB88.1050500@mailnetwork.co.uk (view raw or flat)
Thread:
Lists: pgsql-php
Excellent :)

No probs, and thanks for posting your solution, it may help someone else 
out in the future!

Andy.

Fatih Gulec wrote:
> I solve the problem by the help of Andy.
>
> 1. I change SELinux policy of the /tmp
>    [root(at)bulbul /]# chcon -R -h -t httpd_sys_script_rw_t /tmp
> 2. I change connection string
>    old : pgsql://postgres:bbmprens(at)127(dot)0(dot)0(dot)1/prens
>    new : pgsql://postgres:bbmprens(at)unix(/tmp)/prens
>
> Then it works.
>
> Thank you so much Andy.
>
>   
>> Faith,
>>
>> I'm guessing one of 2 things is happening here:
>>
>> - PHP is connecting through the Unix socket in /tmp, and permissions are
>> wrong on the /tmp directory for the Apache user
>> - Something like TCP wrappers is blocking localhost connections
>>
>> Try changing the connection host to the machine's ethernet IP address
>> instead of 127.0.0.1, this will give you a clue if this is the case.
>> You could also examine the PostgreSQL logs - I doubt if it would log
>> this error, but it's worth a shot.
>>
>> Andy.
>>
>> Fatih Gulec wrote:
>>     
>>> Here is the problem :
>>> System : Fedora Core 5
>>> Application server : Apache (comes with Fedora base installation)
>>>
>>> 1. I could not connect to postgresql in php code whicih uses pear packet
>>> DB. Here is the error code :
>>> DB Error: connect failed [nativecode=Unable to connect to PostgreSQL
>>> server: could not connect to server: Permission denied Is the server
>>> running on host "127.0.0.1" and accepting TCP/IP connections on port
>>> 5432?] ** pgsql://postgres:bbmprens(at)127(dot)0(dot)0(dot)1/prens
>>>
>>> 2. By the way I can connect that db from an other machine which the
>>> system
>>> is Windows XP and program is default PgAdmin.
>>> 2. Alsa I can connect and use from a windows machine with the sama php
>>> code that connects to the dbms which works on the Fedora Core 5.
>>> 3. The user and password are tested by using pgsql command, in command
>>> prompt.
>>>
>>> Thanks...
>>>
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 1: if posting/reading through Usenet, please send an appropriate
>>>        subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>>>        message can get through to the mailing list cleanly
>>>
>>>
>>>
>>>
>>>
>>>       
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: In versions below 8.0, the planner will ignore your desire to
>>        choose an index scan if your joining column's datatypes do not
>>        match
>>
>>     
>
>
> !DSPAM:37,44e0388d143291488815628!
>
>
>   


In response to

pgsql-php by date

Next:From: babak badaeiDate: 2006-08-31 06:25:58
Subject: Postgres 8.1.4 + PHP, hangs when querying more than 16 records!
Previous:From: Fatih GulecDate: 2006-08-14 08:48:43
Subject: Re: DB Error: connect failed

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group