BUG #2118: could not connect to server

Started by zhugeover 20 years ago5 messagesbugs
Jump to latest
#1zhuge
zhuge@Rinaix.cn

The following bug has been logged online:

Bug reference: 2118
Logged by: zhuge xiao
Email address: zhuge@Rinaix.cn
PostgreSQL version: 8.0.3
Operating system: Linux ( FC4 )
Description: could not connect to server
Details:

Help me!

I have edited the program testlibpq.c which is copied from the PostgreSQL
document to make it become a CGI program. And I have succeeded to compile
the programme, testlibpq.c from the command line:
[zhuge@xiao2 src]$ cc -o testlibpq testlibpq.c -lpq

And it can run from the command line:
[zhuge@xiao2 src]$ ./testlibpq

Then, I copied the excuteable program to the CGI directory,
/var/www/cgi-bin. And let it run from the Mozilla Firefox browser whose URL
was http://localhost/cgi-bin/testlibpq. But I failed. The result was that
the below message was displayed in the browser:
could not connect to server: Permission denied
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?

The above message was produced by the below code:
if (PQstatus(conn) != CONNECTION_OK)
{
fprintf(stdout, PQerrorMessage(conn));
exit_nicely(conn);
}

How can I do? Please help me!

Thank you very much.

zhuge@Rinaix.cn

#2Devrim GÜNDÜZ
devrim@gunduz.org
In reply to: zhuge (#1)
Re: BUG #2118: could not connect to server

Hi,

On Tue, 2005-12-20 at 08:44 +0000, zhuge xiao wrote:

PostgreSQL version: 8.0.3
Operating system: Linux ( FC4 )
Description: could not connect to server
Details:

I have edited the program testlibpq.c which is copied from the PostgreSQL
document to make it become a CGI program. And I have succeeded to compile
the programme, testlibpq.c from the command line:
[zhuge@xiao2 src]$ cc -o testlibpq testlibpq.c -lpq

And it can run from the command line:
[zhuge@xiao2 src]$ ./testlibpq

Then, I copied the excuteable program to the CGI directory,
/var/www/cgi-bin. And let it run from the Mozilla Firefox browser whose URL
was http://localhost/cgi-bin/testlibpq. But I failed. The result was that
the below message was displayed in the browser:
could not connect to server: Permission denied
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?

Is postmaster running?

Regards,
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: PL/php, plPerlNG - http://www.commandprompt.com/

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: zhuge (#1)
Re: BUG #2118: could not connect to server

"zhuge xiao" <zhuge@Rinaix.cn> writes:

could not connect to server: Permission denied
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?

"Permission denied" indicates a file permissions problem.  Check the
permissions on /tmp and on the socket file itself.  If you have SELinux
enabled in enforcing mode, you might also have a SELinux policy problem
--- is your selinux-policy package up to date?

regards, tom lane

#4zhuge xiao
xiao.zhuge@hhstech.cn
In reply to: Tom Lane (#3)
Re: [BUGS] BUG #2118: could not connect to server

Tom Lane,

I have read the email you mailed me. And I have SELinux enabled in permissive mode and the testlibpq program can run. I am very happy. In the future, I will use the PostgreSQL and give up the MySQL and other databases. I think the PostgreSQL is better than the others.

Thank you very much.

zhuge xiao <zhuge@Rinaix.cn>

Tom Lane wrote:

Show quoted text

"zhuge xiao" <zhuge@Rinaix.cn> writes:

could not connect to server: Permission denied
Is the server running locally and accepting connections on Unix domain
socket "/tmp/.s.PGSQL.5432"?

"Permission denied" indicates a file permissions problem.  Check the
permissions on /tmp and on the socket file itself.  If you have SELinux
enabled in enforcing mode, you might also have a SELinux policy problem
--- is your selinux-policy package up to date?

regards, tom lane

#5zhuge
zhuge_xiao@yahoo.com
In reply to: zhuge xiao (#4)
Re: [BUGS] BUG #2118: could not connect to server [From zhuge xiao <zhuge@Rinaix.cn>]

Tom Lane,

I have read the email you mailed me yesterday. And I
have SELinux enabled in permissive mode and the
testlibpq program can run. I am very happy. In the
future, I will use the PostgreSQL and give up the
MySQL and other databases. I think the PostgreSQL is
better than the others.

Thank you very much.

zhuge xiao <zhuge@Rinaix.cn>

Tom Lane wrote:

"zhuge xiao" <zhuge@Rinaix.cn> writes:

could not connect to server: Permission denied
Is the server running locally and accepting

connections on Unix domain

socket "/tmp/.s.PGSQL.5432"?

"Permission denied" indicates a file permissions

problem. Check the

permissions on /tmp and on the socket file itself.

If you have SELinux

enabled in enforcing mode, you might also have a

SELinux policy problem

--- is your selinux-policy package up to date?

regards, tom lane

__________________________________________
Yahoo! DSL � Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com