Apache Server configuration support - CGI-script cannot open socket

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > February 2006 > CGI-script cannot open socket





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author CGI-script cannot open socket
Florian_Rampp

2006-02-02, 8:06 am

Hello!

I've been trying for a few days to configure Apache properly, so that
the following little test-cgi-script will work:

if((s = socket(PF_INET, SOCK_STREAM, 0) < 0) {
snprintf (buf, 1024, "socket: permission denied!<br>\n");
snprintf(buf + strlen(buf), 1024, "error: %d\n", errno);
error_html(buf); // simply generates an apropriate html page around
it and prints it via printf
return 1;
}
else {
snprintf (buf, 1024, "socket: DONE!\n");
error_html(buf);
return 0;
}

If I start the script at a local bash by the user, to which apache
drops privileges, than the script outputs: "socket: DONE!". For testing
purposes, this user is member of the group "root".
But if I put the script into the cgi-bin of my apache installation, and
call it by a browser, it always outputs: "socket: permission denied<br>
error: 13" (
which means: Permission denied for creating a socket).
But why does this fail?

CGI should be configured correctly:

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory "/var/www/cgi-bin">
Allow Override None
Options ExecCGI
Order allow, deny
Allow from all
</Directory>

The error_log doesn't report anything. (log level is debug).
The access_log shows the request for the cgi-bin.

So, why the hell doesn't this work?


Thank you for your answers!

Greetings,

Florian

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com