httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <>
Subject Re: CGI in users own dirs
Date Wed, 19 Dec 2001 13:33:58 GMT
W i l l y wrote:
> Okay I tried to find any other ExecCGI in the document, but I did not have
> any luck, so I tried to see what output I got directly from the server.
> Basically it said 'The server encountered an internal error or
> misconfiguration and was unable to complete
> your request', and that I should check the error logs, which still say
> '

Not so fast, Mr. Bond. There is still one thing you haven't tried...

The 'Premature end of script headers.' is actually a good thing. It
proves that apache is executing the program so in fact apache is now
working correctly. The probelm is that your program is not outputting
the CGI script header.

I can't remember if you tried running the script from the command line -
I think you did and it was OK.

However, it still can fail when called by apache because when you run
it, it runs with your account ENV variables and privileges. When apache
runs it, it runs in a different environment - as the user defined by the
"User" directive. It is not uncommon for the differences to produce
subtle problems.

You now have to debug a CGI - this is a tricky task because of the
problem above and because most of the output is lost... Unless you
switch on ScriptLogging!

ScriptLog logs/common_script_log

note that, unlike the other logs, this logfile must be owned by the
apache User (e.g. "apache"). The easiest way to do this is to create the
log first, as root, then change its ownership to "apache" - then restart
the server, e.g.

# cd /usr/local/apache/logs
# touch common_script_log
# chown apache common_script_log

The output from any failing CGIs will now end up in this file and you
should see what is wrong with your program. Check the mod_cgi section of
the docs for more details.


Owen Boyle.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message