Click to See Complete Forum and Search --> : Bizarre CGI problem


sploo22
06-11-2003, 01:57 PM
I'm running an Apache 1.3.26 server with user directories set up so that /usr/www/<username> is accessible both as http://server/~<username> and as http://server/users/<username>. With the second form everything's perfect, but when I use the first notation all of my scripts fail with "500 Internal Server Error". The error log says "Premature end of script headers".

I know this sounds like a typical stupid newbie mistake, but bear with me. ;) First of all, the difference between the two methods of accessing shouldn't affect CGI programs. Also, by putting the command "env > /tmp/tempfile.$$" at the very beginning of the file, I determined that the script is not being excuted at all; no file is created. Other types of files, including HTML and PHP scripts, work fine either way.

Is this a bug in Apache or mod_userdir?

sploo22
06-15-2003, 08:54 PM
Beware of things that go BUMP in the night... :D

Stuka
06-16-2003, 10:14 AM
Just a thought, as I'm no expert on the matter - do your scripts get called with relative pathnames, and could that be screwing you up? Seems likely, IMO.

sploo22
06-16-2003, 01:46 PM
I don't see how - like I said, not even the first line of the script is getting executed. I'm not realy sure what you mean, though... :confused:

Thanks! ;)

Stuka
06-16-2003, 03:18 PM
What I'm thinking is that whatever calls the scripts (forms, etc.) may use a relative link that doesn't work properly when called from the http://server/~<username> form of the page.

sploo22
06-17-2003, 05:43 PM
I'm not using a form. This is just a little test script; I'm just typing the URL in directly. But the only file that needs to be loaded is /bin/sh; how would that be affected by relative pathnames?

I don't mean to be sarcastic, I'm genuinely confused. :confused:

Stuka
06-18-2003, 10:36 AM
OK, could it be that using that particular directory name, Apache doesn't recognize it as a directory that's allowed to have CGI scripts?

sploo22
06-23-2003, 11:36 AM
That's what I thought at first, but I have Options +ExecCGI turned on for both of them, plus I have AllowOverride All for both forms and Options +ExecCGI in my .htaccess file.

This is pretty baffling, isn't it? :D It's pretty ironic that this is the sort of thing that happens all the time in Windows.

Stuka
06-23-2003, 02:40 PM
Definitely odd...have you considered posing this question over in the Web Serving/Security forum? In my experience, the Apache know-how over there is a bit deeper, and few of the folks who read that forum check this one regularly.