You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike Price <mj...@yahoo.com> on 2002/03/17 11:57:42 UTC

Apache 2.0, CGI, and error 500

I am unable to get CGI programs to work under
Apache 2.0.32. All of these programs work under
Apache 1.3.23. Under 2.0.32 they all produce error
"500 Premature end of script headers". The ScriptLog
output shows nothing following the %response line -
the scripts produce no output at all. An "ls -lu"
shows
that the script files are NOT being accessed. The
error log shows the correct file name for the script -
it's as though Apache cannot execute the file.
Permissions are 755 on the scripts and 711 on the
directory. User/group is consistent on both and
different from the server user/group. ScriptAlias
points to the directory.

I've poured over the conf file and tried numerous
alternatives with no luck.

Can anyone give me some idea what's going on?

Thanks,
Mike Price

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache 2.0, CGI, and error 500

Posted by Artiom Morozov <ar...@phreaker.net>.
forked child crashes =( imo it's a bug in apache and you can post it 
somewhere on httpd.apache.org

On 2002.03.17 20:46 Mike Price wrote:
> Ran strace on httpd, got this (sorry for the long
> post):
> 
> 24942 read(12, "GET /cgi-bin/shscript\r\n", 8192) = 18
> 24942 stat("/home/httpd/cgi-bin/shscript",
> {st_mode=030172, st_size=0, ...}) = 0
> 24942 pipe([13, 14])                    = 0
> 24942 fcntl(14, F_GETFL)                = 0x1 (flags
> O_WRONLY)
> 24942 fcntl(14, F_SETFL, O_WRONLY|O_NONBLOCK) = 0
> 24942 pipe([15, 16])                    = 0
> 24942 fcntl(15, F_GETFL)                = 0 (flags
> O_RDONLY)
> 24942 fcntl(15, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
> 24942 pipe([17, 18])                    = 0
> 24942 fcntl(17, F_GETFL)                = 0 (flags
> O_RDONLY)
> 24942 fcntl(17, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
> 24942 fork()                            = 24955
> 24942 close(13)                         = 0
> 24942 close(16)                         = 0
> 24942 close(18)                         = 0
> 24942 close(14)                         = 0
> 24942 read(15, 0xbfffbb70, 1)           = -1 EAGAIN
> (Resource temporarily unavai
> lable)
> 24942 select(1024, [15], NULL, NULL, {300, 0}
> <unfinished ...>
> 24955 getpid()                          = 24955
> 24955 close(6)                          = 0
> 24955 close(10)                         = 0
> 24955 close(7)                          = 0
> 24955 close(11)                         = 0
> 24955 unlink("/tmp/aprnP36ci")          = -1 ENOENT
> (No such file or directory)
> 24955 close(-1)                         = -1 EBADF
> (Bad file descriptor)
> 24955 --- SIGSEGV (Segmentation fault) ---
> 24955 chdir("/usr/local/apache2")       = 0
> 24955 SYS_174(0xb, 0xbfffb688, 0xbfffb5fc, 0x8, 0xb) =
> 0
> 24955 getpid()                          = 24955
> 24955 kill(24955, SIGSEGV)              = 0
> 24955 sigreturn()                       = ? (mask now
> [])
> 24955 --- SIGSEGV (Segmentation fault) ---
> 24942 <... select resumed> )            = 1 (in [15],
> left {300, 0})
> 24942 --- SIGCHLD (Child exited) ---
> 
> The st_mode of the file appears to be correct but the
> read fails (EAGAIN). I'm stumped.
> 
> 
> --- Artiom Morozov <ar...@phreaker.net> wrote:
> > Ok, then i'd advise you to use strace(1) to attach
> > to server children
> > and see what's going on. See man strace
> >
> > On 2002.03.17 13:31 Mike Price wrote:
> > > LogLevel IS at debug and ScriptLog IS set. The
> > > log file appears:
> > >
> > > %% [Sun Mar 17 03:19:06 2002] GET
> > /cgi-bin/shscript
> > > HTTP/1.0
> > > %% 500 /home/httpd/cgi-bin/shscript
> > > %request
> > > Referer: http://www.---.com/Home.html
> > > Connection: Keep-Alive
> > > User-Agent: Mozilla/4.79 [en] (WinNT; U)
> > > Host: www.---.com
> > > Accept: image/gif, image/x-xbitmap, image/jpeg,
> > > image/pjpeg, image/png, */*
> > > Accept-Encoding: gzip
> > > Accept-Language: en
> > > Accept-Charset: iso-8859-1,*,utf-8
> > > Extension: Security/Remote-Passphrase
> > > %response
> > >
> > > Note that nothing follows the %response line - the
> > > script appears not to produce any output. If I run
> > > the script as the server user, it works fine. The
> > > script file is NOT being accessed (as reported by
> > ls
> > > -lu).
> > >
> > > --- Artiom Morozov <ar...@phreaker.net> wrote:
> > > > Ok, you're at the final stage - set LogLevel to
> > > > debug and enable
> > > > ScriptLog (beware of permissions for scriptlog!
> > =).
> > > > There then will
> > > > your answer be (excuse my english ;-)
> > > >
> > > > On 2002.03.17 13:17 Mike Price wrote:
> > > > > I checked httpd -l and it's using mod_cgi.
> > > > >
> > > > > --- Artiom Morozov <ar...@phreaker.net>
> > wrote:
> > > > > > probably you compiled mod_cgid instead of
> > > > mod_cgi
> > > > > >
> > > > > > îÁ 2002.03.17 12:57 Mike Price ÎÁÐÉÓÁÌ:
> > > > > > > I am unable to get CGI programs to work
> > under
> > > > > > > Apache 2.0.32. All of these programs work
> > > > under
> > > > > > > Apache 1.3.23. Under 2.0.32 they all
> > produce
> > > > error
> > > > > > > "500 Premature end of script headers". The
> > > > > > ScriptLog
> > > > > > > output shows nothing following the
> > %response
> > > > line
> > > > > > -
> > > > > > > the scripts produce no output at all. An
> > "ls
> > > > -lu"
> > > > > > > shows
> > > > > > > that the script files are NOT being
> > accessed.
> > > > The
> > > > > > > error log shows the correct file name for
> > the
> > > > > > script -
> > > > > > > it's as though Apache cannot execute the
> > file.
> > > > > > > Permissions are 755 on the scripts and 711
> > on
> > > > the
> > > > > > > directory. User/group is consistent on
> > both
> > > > and
> > > > > > > different from the server user/group.
> > > > ScriptAlias
> > > > > > > points to the directory.
> > > >
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > The official User-To-User support forum of the
> > > > Apache HTTP Server Project.
> >
> >
> ---------------------------------------------------------------------
> > 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
> > For additional commands, e-mail:
> > users-help@httpd.apache.org
> >
> 
> 

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache 2.0, CGI, and error 500

Posted by Mike Price <mj...@yahoo.com>.
Ran strace on httpd, got this (sorry for the long
post):

24942 read(12, "GET /cgi-bin/shscript\r\n", 8192) = 18
24942 stat("/home/httpd/cgi-bin/shscript",
{st_mode=030172, st_size=0, ...}) = 0
24942 pipe([13, 14])                    = 0
24942 fcntl(14, F_GETFL)                = 0x1 (flags
O_WRONLY)
24942 fcntl(14, F_SETFL, O_WRONLY|O_NONBLOCK) = 0
24942 pipe([15, 16])                    = 0
24942 fcntl(15, F_GETFL)                = 0 (flags
O_RDONLY)
24942 fcntl(15, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
24942 pipe([17, 18])                    = 0
24942 fcntl(17, F_GETFL)                = 0 (flags
O_RDONLY)
24942 fcntl(17, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
24942 fork()                            = 24955
24942 close(13)                         = 0
24942 close(16)                         = 0
24942 close(18)                         = 0
24942 close(14)                         = 0
24942 read(15, 0xbfffbb70, 1)           = -1 EAGAIN
(Resource temporarily unavai
lable)
24942 select(1024, [15], NULL, NULL, {300, 0}
<unfinished ...>
24955 getpid()                          = 24955
24955 close(6)                          = 0
24955 close(10)                         = 0
24955 close(7)                          = 0
24955 close(11)                         = 0
24955 unlink("/tmp/aprnP36ci")          = -1 ENOENT
(No such file or directory)
24955 close(-1)                         = -1 EBADF
(Bad file descriptor)
24955 --- SIGSEGV (Segmentation fault) ---
24955 chdir("/usr/local/apache2")       = 0
24955 SYS_174(0xb, 0xbfffb688, 0xbfffb5fc, 0x8, 0xb) =
0
24955 getpid()                          = 24955
24955 kill(24955, SIGSEGV)              = 0
24955 sigreturn()                       = ? (mask now
[])
24955 --- SIGSEGV (Segmentation fault) ---
24942 <... select resumed> )            = 1 (in [15],
left {300, 0})
24942 --- SIGCHLD (Child exited) ---

The st_mode of the file appears to be correct but the
read fails (EAGAIN). I'm stumped.


--- Artiom Morozov <ar...@phreaker.net> wrote:
> Ok, then i'd advise you to use strace(1) to attach
> to server children 
> and see what's going on. See man strace
> 
> On 2002.03.17 13:31 Mike Price wrote:
> > LogLevel IS at debug and ScriptLog IS set. The
> > log file appears:
> > 
> > %% [Sun Mar 17 03:19:06 2002] GET
> /cgi-bin/shscript
> > HTTP/1.0
> > %% 500 /home/httpd/cgi-bin/shscript
> > %request
> > Referer: http://www.---.com/Home.html
> > Connection: Keep-Alive
> > User-Agent: Mozilla/4.79 [en] (WinNT; U)
> > Host: www.---.com
> > Accept: image/gif, image/x-xbitmap, image/jpeg,
> > image/pjpeg, image/png, */*
> > Accept-Encoding: gzip
> > Accept-Language: en
> > Accept-Charset: iso-8859-1,*,utf-8
> > Extension: Security/Remote-Passphrase
> > %response
> > 
> > Note that nothing follows the %response line - the
> > script appears not to produce any output. If I run
> > the script as the server user, it works fine. The
> > script file is NOT being accessed (as reported by
> ls
> > -lu).
> > 
> > --- Artiom Morozov <ar...@phreaker.net> wrote:
> > > Ok, you're at the final stage - set LogLevel to
> > > debug and enable
> > > ScriptLog (beware of permissions for scriptlog!
> =).
> > > There then will
> > > your answer be (excuse my english ;-)
> > >
> > > On 2002.03.17 13:17 Mike Price wrote:
> > > > I checked httpd -l and it's using mod_cgi.
> > > >
> > > > --- Artiom Morozov <ar...@phreaker.net>
> wrote:
> > > > > probably you compiled mod_cgid instead of
> > > mod_cgi
> > > > >
> > > > > �� 2002.03.17 12:57 Mike Price �������:
> > > > > > I am unable to get CGI programs to work
> under
> > > > > > Apache 2.0.32. All of these programs work
> > > under
> > > > > > Apache 1.3.23. Under 2.0.32 they all
> produce
> > > error
> > > > > > "500 Premature end of script headers". The
> > > > > ScriptLog
> > > > > > output shows nothing following the
> %response
> > > line
> > > > > -
> > > > > > the scripts produce no output at all. An
> "ls
> > > -lu"
> > > > > > shows
> > > > > > that the script files are NOT being
> accessed.
> > > The
> > > > > > error log shows the correct file name for
> the
> > > > > script -
> > > > > > it's as though Apache cannot execute the
> file.
> > > > > > Permissions are 755 on the scripts and 711
> on
> > > the
> > > > > > directory. User/group is consistent on
> both
> > > and
> > > > > > different from the server user/group.
> > > ScriptAlias
> > > > > > points to the directory.
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > The official User-To-User support forum of the
> > > Apache HTTP Server Project.
> 
>
---------------------------------------------------------------------
> 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
> For additional commands, e-mail:
> users-help@httpd.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache 2.0, CGI, and error 500

Posted by Artiom Morozov <ar...@phreaker.net>.
Ok, then i'd advise you to use strace(1) to attach to server children 
and see what's going on. See man strace

On 2002.03.17 13:31 Mike Price wrote:
> LogLevel IS at debug and ScriptLog IS set. The
> log file appears:
> 
> %% [Sun Mar 17 03:19:06 2002] GET /cgi-bin/shscript
> HTTP/1.0
> %% 500 /home/httpd/cgi-bin/shscript
> %request
> Referer: http://www.---.com/Home.html
> Connection: Keep-Alive
> User-Agent: Mozilla/4.79 [en] (WinNT; U)
> Host: www.---.com
> Accept: image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, image/png, */*
> Accept-Encoding: gzip
> Accept-Language: en
> Accept-Charset: iso-8859-1,*,utf-8
> Extension: Security/Remote-Passphrase
> %response
> 
> Note that nothing follows the %response line - the
> script appears not to produce any output. If I run
> the script as the server user, it works fine. The
> script file is NOT being accessed (as reported by ls
> -lu).
> 
> --- Artiom Morozov <ar...@phreaker.net> wrote:
> > Ok, you're at the final stage - set LogLevel to
> > debug and enable
> > ScriptLog (beware of permissions for scriptlog! =).
> > There then will
> > your answer be (excuse my english ;-)
> >
> > On 2002.03.17 13:17 Mike Price wrote:
> > > I checked httpd -l and it's using mod_cgi.
> > >
> > > --- Artiom Morozov <ar...@phreaker.net> wrote:
> > > > probably you compiled mod_cgid instead of
> > mod_cgi
> > > >
> > > > îÁ 2002.03.17 12:57 Mike Price ÎÁÐÉÓÁÌ:
> > > > > I am unable to get CGI programs to work under
> > > > > Apache 2.0.32. All of these programs work
> > under
> > > > > Apache 1.3.23. Under 2.0.32 they all produce
> > error
> > > > > "500 Premature end of script headers". The
> > > > ScriptLog
> > > > > output shows nothing following the %response
> > line
> > > > -
> > > > > the scripts produce no output at all. An "ls
> > -lu"
> > > > > shows
> > > > > that the script files are NOT being accessed.
> > The
> > > > > error log shows the correct file name for the
> > > > script -
> > > > > it's as though Apache cannot execute the file.
> > > > > Permissions are 755 on the scripts and 711 on
> > the
> > > > > directory. User/group is consistent on both
> > and
> > > > > different from the server user/group.
> > ScriptAlias
> > > > > points to the directory.
> >
> >
> >
> ---------------------------------------------------------------------
> > The official User-To-User support forum of the
> > Apache HTTP Server Project.

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache 2.0, CGI, and error 500

Posted by Mike Price <mj...@yahoo.com>.
LogLevel IS at debug and ScriptLog IS set. The
log file appears:

%% [Sun Mar 17 03:19:06 2002] GET /cgi-bin/shscript
HTTP/1.0
%% 500 /home/httpd/cgi-bin/shscript
%request
Referer: http://www.---.com/Home.html
Connection: Keep-Alive
User-Agent: Mozilla/4.79 [en] (WinNT; U)
Host: www.---.com
Accept: image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8
Extension: Security/Remote-Passphrase
%response

Note that nothing follows the %response line - the
script appears not to produce any output. If I run
the script as the server user, it works fine. The
script file is NOT being accessed (as reported by ls
-lu).

--- Artiom Morozov <ar...@phreaker.net> wrote:
> Ok, you're at the final stage - set LogLevel to
> debug and enable
> ScriptLog (beware of permissions for scriptlog! =).
> There then will
> your answer be (excuse my english ;-)
> 
> On 2002.03.17 13:17 Mike Price wrote:
> > I checked httpd -l and it's using mod_cgi.
> > 
> > --- Artiom Morozov <ar...@phreaker.net> wrote:
> > > probably you compiled mod_cgid instead of
> mod_cgi
> > >
> > > �� 2002.03.17 12:57 Mike Price �������:
> > > > I am unable to get CGI programs to work under
> > > > Apache 2.0.32. All of these programs work
> under
> > > > Apache 1.3.23. Under 2.0.32 they all produce
> error
> > > > "500 Premature end of script headers". The
> > > ScriptLog
> > > > output shows nothing following the %response
> line
> > > -
> > > > the scripts produce no output at all. An "ls
> -lu"
> > > > shows
> > > > that the script files are NOT being accessed.
> The
> > > > error log shows the correct file name for the
> > > script -
> > > > it's as though Apache cannot execute the file.
> > > > Permissions are 755 on the scripts and 711 on
> the
> > > > directory. User/group is consistent on both
> and
> > > > different from the server user/group.
> ScriptAlias
> > > > points to the directory.
> 
> 
>
---------------------------------------------------------------------
> 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
> For additional commands, e-mail:
> users-help@httpd.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache 2.0, CGI, and error 500

Posted by Artiom Morozov <ar...@phreaker.net>.
Ok, you're at the final stage - set LogLevel to debug and enable
ScriptLog (beware of permissions for scriptlog! =). There then will
your answer be (excuse my english ;-)

On 2002.03.17 13:17 Mike Price wrote:
> I checked httpd -l and it's using mod_cgi.
> 
> --- Artiom Morozov <ar...@phreaker.net> wrote:
> > probably you compiled mod_cgid instead of mod_cgi
> >
> > îÁ 2002.03.17 12:57 Mike Price ÎÁÐÉÓÁÌ:
> > > I am unable to get CGI programs to work under
> > > Apache 2.0.32. All of these programs work under
> > > Apache 1.3.23. Under 2.0.32 they all produce error
> > > "500 Premature end of script headers". The
> > ScriptLog
> > > output shows nothing following the %response line
> > -
> > > the scripts produce no output at all. An "ls -lu"
> > > shows
> > > that the script files are NOT being accessed. The
> > > error log shows the correct file name for the
> > script -
> > > it's as though Apache cannot execute the file.
> > > Permissions are 755 on the scripts and 711 on the
> > > directory. User/group is consistent on both and
> > > different from the server user/group. ScriptAlias
> > > points to the directory.


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache 2.0, CGI, and error 500

Posted by Mike Price <mj...@yahoo.com>.
I checked httpd -l and it's using mod_cgi.

--- Artiom Morozov <ar...@phreaker.net> wrote:
> probably you compiled mod_cgid instead of mod_cgi
> 
> �� 2002.03.17 12:57 Mike Price �������:
> > I am unable to get CGI programs to work under
> > Apache 2.0.32. All of these programs work under
> > Apache 1.3.23. Under 2.0.32 they all produce error
> > "500 Premature end of script headers". The
> ScriptLog
> > output shows nothing following the %response line
> -
> > the scripts produce no output at all. An "ls -lu"
> > shows
> > that the script files are NOT being accessed. The
> > error log shows the correct file name for the
> script -
> > it's as though Apache cannot execute the file.
> > Permissions are 755 on the scripts and 711 on the
> > directory. User/group is consistent on both and
> > different from the server user/group. ScriptAlias
> > points to the directory.
> > 
> > I've poured over the conf file and tried numerous
> > alternatives with no luck.
> > 
> > Can anyone give me some idea what's going on?
> 
>
---------------------------------------------------------------------
> 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
> For additional commands, e-mail:
> users-help@httpd.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache 2.0, CGI, and error 500

Posted by Artiom Morozov <ar...@phreaker.net>.
probably you compiled mod_cgid instead of mod_cgi

îÁ 2002.03.17 12:57 Mike Price ÎÁÐÉÓÁÌ:
> I am unable to get CGI programs to work under
> Apache 2.0.32. All of these programs work under
> Apache 1.3.23. Under 2.0.32 they all produce error
> "500 Premature end of script headers". The ScriptLog
> output shows nothing following the %response line -
> the scripts produce no output at all. An "ls -lu"
> shows
> that the script files are NOT being accessed. The
> error log shows the correct file name for the script -
> it's as though Apache cannot execute the file.
> Permissions are 755 on the scripts and 711 on the
> directory. User/group is consistent on both and
> different from the server user/group. ScriptAlias
> points to the directory.
> 
> I've poured over the conf file and tried numerous
> alternatives with no luck.
> 
> Can anyone give me some idea what's going on?

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org