Search Postgresql Archives

Re: Unable to connect to Postgresql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 07 April 2017 20:35:40 Adrian Klaver wrote:
> On 04/07/2017 05:03 PM, John Iliffe wrote:
> 
> Please reply to list also
Yes, sorry about that.

> Ccing list.
> 
> > On Friday 07 April 2017 18:58:15 you wrote:
> >> On 04/07/2017 02:38 PM, John Iliffe wrote:
> >>> When I attempt to run any web application php cannot open a database
> >>> because of failure to connect.  (Please disregard the programme
> >>> name, it is running in mod_php, not as an fcgi module).  The (php)
> >>> message is:
> >>> 
> >>> --------------------------
> >>> [Fri Apr 07 17:03:28.597101 2017] [php7:warn] [pid 1797:tid
> >>> 140599445419776] [client 192.168.1.10:45127] PHP Warning:
> >>> pg_connect(): Unable to connect to PostgreSQL server: could not
> >>> connect to server: No such file or directory\n\tIs the server
> >>> running locally and
> >>> accepting\n\tconnections on Unix domain socket
> >>> "/tmp/.s.PGSQL.5432"? in /httpd/iliffe/testfcgi.php on
> >>> line 121 ----------------------------
> >>> 
> >>> The proper socket does exist:
> >>> 
> >>> -------------------------------------
> >>> ls -al /tmp | grep PGSQL
> >>> srwxrwxrwx.  1 postgres postgres    0 Apr  7 16:53 .s.PGSQL.5432
> >>> -rw-------.  1 postgres postgres   49 Apr  7 16:53
> >>> .s.PGSQL.5432.lock
> >>> 
> >>> ss -a | grep 5432
> >>> u_str  LISTEN     0      128    /tmp/.s.PGSQL.5432 30480
> >>> 
> >>>  * 0 -------------------------------------
> >>> 
> >>> Running on Fedora 25 with SELinux in PERMISSIVE mode.  The audit log
> >>> shows no hits on Postgresql.
> >>> 
> >>> Postgresql version number is 9.6.2
> >>> 
> >>> As expected, the postgresql log shows nothing since the last start
> >>> up.
> >> 
> >> Meant to add to previous post:
> >> 
> >> What happens if you try to connect to the database using psql?
> > 
> > Works just as I would expect.
> > 
> > In fact, I was able to load the one of the databases from the pg_dump
> > backup using pg_restore without any problems either, and I checked the
> > results by running some in-stream transactions in psql.  Everything
> > went fine at that point, until I tried to start Apache and couldn't
> > connect.
> 
> To be precise PHP could not connect, correct?

Yes.  The "unable to connect" message is being issued by PHP.  But PHP 
seems to know what is required (Unix domain socket number and where to find 
it are both correct as far as I can see.
> 
> > My going in position was/still is, that this is a SELinux security
> > problem but I am finding SELinux to be the most opaque and badly
> > documented software that I have ever had to deal with, which is why
> > it is running in permissive mode at the moment.
> 
> Well what I know about SELinux would fit in the navel of a flea(tip of
> the hat to David Niven), so I can not be of much help there. The reason
> I am returned this thread to the list, there are folks that do
> understand it.
> 
> > Regards,
> > 
> > John
> > 
> >>> Thanks in advance.
> >>> 
> >>> John
> >>> =====================================


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux