httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karel Kubat <ka...@e-tunity.com>
Subject Re: [users@httpd] My apache server stopped doing CGI
Date Mon, 16 Feb 2009 08:14:52 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Kevin,

On Feb 16, 2009, at 1:41 AM, Kevin O'Gorman wrote:

> The logs are not much help.  The access log shows that the
> request got an error code,
> 64.166.164.49 - - [15/Feb/2009:15:46:32 -0800] "GET /hex-bin/board
> HTTP/1.1" 500 542

OK.. so a HTTP 500 (internal server error) code.

> and all that the error log says is:
> [Sun Feb 15 15:46:32 2009] [error] [client 64.166.164.49] Premature
> end of script headers: board

This usually indicates that the script didn't send "Content-Type: text/ 
html" as its first line (at least, in my case, because that's what I  
usually forget).

> I put a simple C program in there to create a file in /tmp, and  
> nothing happens.

You mean you replaced /hex-bin/board with another CGI that didn't  
execute? Strange, because the error log above indicates invalid  
execution - but execution nonetheless.

> So the question is: how can I debug this?  Or does anyone have an
> inuition about what might be wrong?

Have your script send messages to stderr. These will go into Apache's  
error log.

Alternatively, to work from the CLI, proceed as follows. Set the  
environment variable QUERY_STRING to your input arguments (as in,  
export QUERY_STRING="name=Kevin&location=San+Francisco") so you can  
run the script from the commandline and see what happens. The script  
must answer with Content-Type: text/html followed by one empty line,  
and then must send HTML that the browser would render.

Also very important: try the CLI approach while under the permissions  
of the Apache user (stated in your httpd.conf). E.g., if your user is  
"www", then:
	su - www
	cd /hex/bin/
	export .... and so on
That way you truly verify that the www user has access to the cgi-bin  
directory and may run the script.

- --
Best regards / met vriendelijke groet, Karel Kubat
Mob +31 6 2956 4861



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkmZIHwACgkQ23FrzRzybNWYXQCeOfVYHPlwZ4Yyo8U+noV13Pbz
sv8AoLqLdjj0F8sS1AzGbhASbgKlgBFq
=sUrI
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message