You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Brian Capouch <br...@palaver.net> on 2002/04/04 09:40:44 UTC

Change in CGI config for 2.0.x? @@!$!@$!#$

Three days and three nights of "ScriptAlias" and "ExecCGI" directives,
and any and all attempts I make to run a CGI script fail, "Server Error:
Premature end of script headers."

I have built and configured many 1.x servers, and have showed my configs
to several accomplished Apache jocks.  Always the same reply, "This
ought to work."

I know the file is being found b/c I change the name and the error
message changes to "File not found."

I'm not sure what reward I could give, but eternal gratitude isn't to be
taken lightly :-)

I won't burden anyone with further details, but will be glad to send
oodles on request.

Thanks.

B.

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Owen Boyle <ob...@bourse.ch>.
Brian Capouch wrote:
> 
> Owen Boyle wrote:
> >
> >
> > Now you should trap the error messages from the CGI in this file and
> > this will hopefully let you see what's going wrong.
> >
> > Given that the scripts work with another version of apache, could be a
> > problem with the CGI.pm module.
> >
> 
> That I've already done, too, and the problem is not just the stock
> scripts that use Perl; the ones shebanging /bin/sh work just as well
> from the command line, and give the same (null) results when run. . .
> 
> %% [Tue Apr 02 01:29:01 2002] GET /cgi-bin/test-cgi HTTP/1.0
> %% 500 /usr/local/apache2/cgi-bin/test-cgi
> %request
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
> */*
> Accept-Charset: iso-8859-1,*,utf-8
> Accept-Encoding: gzip
> Accept-Language: en
> Connection: Keep-Alive
> Host: splurge.palaver.net
> User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.19-pre4 i686)
> %response
> 
> And that's it.  The next line of the file is the next time I attempt to
> access the script, exactly like that set, over and over and over again.

Not sure this will tell you much, but you could run apache in singel
user mode under truss and see what happen when it hits a CGI.., eg.

$ /usr/bin/truss /usr/local/apache/bin/httpd -X

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Brian Capouch <br...@palaver.net>.
Owen Boyle wrote:
> 
> 
> Now you should trap the error messages from the CGI in this file and
> this will hopefully let you see what's going wrong.
> 
> Given that the scripts work with another version of apache, could be a
> problem with the CGI.pm module.
> 

That I've already done, too, and the problem is not just the stock
scripts that use Perl; the ones shebanging /bin/sh work just as well
from the command line, and give the same (null) results when run. . . 

%% [Tue Apr 02 01:29:01 2002] GET /cgi-bin/test-cgi HTTP/1.0
%% 500 /usr/local/apache2/cgi-bin/test-cgi
%request
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png,
*/*
Accept-Charset: iso-8859-1,*,utf-8
Accept-Encoding: gzip
Accept-Language: en
Connection: Keep-Alive
Host: splurge.palaver.net
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.19-pre4 i686)
%response

And that's it.  The next line of the file is the next time I attempt to
access the script, exactly like that set, over and over and over again.

I'm feeling better that at least my first steps correspond with what
others say I should be doing.

Of course it's still not running :-)

Thanks again.

BTW, I've symlinked /usr/local/apache2 to /usr/local/apache, "hoping
against hope," as Mom used to say, that such would make a difference,
but it didn't.

B.

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Owen Boyle <ob...@bourse.ch>.
Brian Capouch wrote:
> 
> Owen Boyle wrote:
> >
> >
> > You didn't answer the $1,000,000 question - does the script output a CGI
> > header before anything else???
> >
> 
> /usr/local/apache/cgi-bin $ ./test-cgi
> Content-type: text/plain
> 
> CGI/1.0 test script report:
> . . .  blah blah blah. . .
> tons of output . . .
>  . . . .
> 
> I hope that's the right answer to the question. . .

10/10. Not outputting a proper header is the commonest cause of a
"Premature end of script headers.." error. Now that we've disposed of
that...

Activate scritplogging to get more information. To do this:

- create a file, e.g. logs/script_log, belonging to the apache User
(this is important, unlike other logfiles, this one must be writeable by
apache user - not just by root).
- define "ScriptLog logs/script_log" in the config.
- restart

Now you should trap the error messages from the CGI in this file and
this will hopefully let you see what's going wrong.

Given that the scripts work with another version of apache, could be a
problem with the CGI.pm module.

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Brian Capouch <br...@palaver.net>.
Owen Boyle wrote:
> 
> 
> You didn't answer the $1,000,000 question - does the script output a CGI
> header before anything else???
> 

/usr/local/apache/cgi-bin $ ./test-cgi
Content-type: text/plain

CGI/1.0 test script report:
. . .  blah blah blah. . .
tons of output . . .
 . . . .

I hope that's the right answer to the question. . . 

B.

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Owen Boyle <ob...@bourse.ch>.
Brian Capouch wrote:
> 
> Owen Boyle wrote:
> >
> >
> > Fine. but:
> >
> > - do you output a CGI header before *any* other output?
> > - what does the script return from the command line?
> >
> 
> Scripts are stock Apache distributed "test-cgi" I think is the name of
> one; they're already in the directory.  They work perfectly from the
> command line, they are executable by the web user, and they contain
> complete paths to the sh and perl executables.
> 
> None of them is of any complexity at all.
> 
> The same scripts work perfectly when dropped into both a 1.x vanilla
> server as well as a 1.x mod_ssl server, and in fact when I point a 1.x
> server on the same box to the htdocs dir that 2.0.x (x = 32 btw) that
> server sees them and runs them perfectly.
> 
> So it's got to be either my Apache build config or the config scripts,
> but neither scenario makes sense given that the server is plainly
> finding the files.
> 
> This one has us all here stumped.

You didn't answer the $1,000,000 question - does the script output a CGI
header before anything else???

Owen BOyle

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Brian Capouch <br...@palaver.net>.
Owen Boyle wrote:
> 
> 
> Fine. but:
> 
> - do you output a CGI header before *any* other output?
> - what does the script return from the command line?
> 

Scripts are stock Apache distributed "test-cgi" I think is the name of
one; they're already in the directory.  They work perfectly from the
command line, they are executable by the web user, and they contain
complete paths to the sh and perl executables.

None of them is of any complexity at all.

The same scripts work perfectly when dropped into both a 1.x vanilla
server as well as a 1.x mod_ssl server, and in fact when I point a 1.x
server on the same box to the htdocs dir that 2.0.x (x = 32 btw) that
server sees them and runs them perfectly.

So it's got to be either my Apache build config or the config scripts,
but neither scenario makes sense given that the server is plainly
finding the files.

This one has us all here stumped.

Thanks.

B.

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Owen Boyle <ob...@bourse.ch>.
Brian Capouch wrote:
> 
> Three days and three nights of "ScriptAlias" and "ExecCGI" directives,
> and any and all attempts I make to run a CGI script fail, "Server Error:
> Premature end of script headers."

Great! That means your CGI environment is correctly configured - the
problem is with your script.

> 
> I have built and configured many 1.x servers, and have showed my configs
> to several accomplished Apache jocks.  Always the same reply, "This
> ought to work."

Indeed - see above.

> 
> I know the file is being found b/c I change the name and the error
> message changes to "File not found."
> 

Fine. but:

- do you output a CGI header before *any* other output?
- what does the script return from the command line?

Rgds,

Owen Boyle

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Brian Capouch <br...@palaver.net>.
Hasanuddin Tamir wrote:
> 
> All important analysis have been performed by Owen. So I guess it could be
> problem with suexec. With my apache that comes with RH, it's possible to
> track the log. The real log goes to suexec.log. I don't believe you can
> find it in file set with ScriptLog. So I always compile apache myself.
> 
> So I as well wait for httpd -l output. It's good to have the info about the
> OS also, and the distribution if possible/available.
> 

System is Slackware 8.0, kernel 2.4.19-pre4, apache 2.0.32.  Files are
in a directory owned by webuser, set for public exec. . . 

Thanks.

B.

Compiled in modules:
  core.c
  mod_access.c
  mod_auth.c
  mod_include.c
  mod_log_config.c
  mod_env.c
  mod_setenvif.c
  mod_ssl.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_cgi.c
  mod_negotiation.c
  mod_dir.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_so.c

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Hasanuddin Tamir <sa...@trabas.com>.
All important analysis have been performed by Owen. So I guess it could be
problem with suexec. With my apache that comes with RH, it's possible to
track the log. The real log goes to suexec.log. I don't believe you can
find it in file set with ScriptLog. So I always compile apache myself.

So I as well wait for httpd -l output. It's good to have the info about the
OS also, and the distribution if possible/available.


-- 
san->http(www.trabas.com)
{If Linux doesn't have solution, you have the wrong problem}

On Thu, 4 Apr 2002, Artiom Morozov <ar...@phreaker.net> wrote,

> Hm, i feel curious enough ;-). Give me the following things:
>
> httpd -l
> su -c "ls -l /path/to/script" apache_user
>
> îÁ 2002.04.04 10:40 Brian Capouch ÎÁÐÉÓÁÌ:
> > Three days and three nights of "ScriptAlias" and "ExecCGI" directives,
> > and any and all attempts I make to run a CGI script fail, "Server
> > Error:
> > Premature end of script headers."
> >
> > I have built and configured many 1.x servers, and have showed my
> > configs
> > to several accomplished Apache jocks.  Always the same reply, "This
> > ought to work."
> >
> > I know the file is being found b/c I change the name and the error
> > message changes to "File not found."
> >
> > I'm not sure what reward I could give, but eternal gratitude isn't to
> > be
> > taken lightly :-)
> >
> > I won't burden anyone with further details, but will be glad to send
> > oodles on request.
> >
> > Thanks.
> >
> > B.
> >
>
> ---------------------------------------------------------------------
> 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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Artiom Morozov <ar...@phreaker.net>.
Hm, i feel curious enough ;-). Give me the following things:

httpd -l
su -c "ls -l /path/to/script" apache_user

îÁ 2002.04.04 10:40 Brian Capouch ÎÁÐÉÓÁÌ:
> Three days and three nights of "ScriptAlias" and "ExecCGI" directives,
> and any and all attempts I make to run a CGI script fail, "Server
> Error:
> Premature end of script headers."
> 
> I have built and configured many 1.x servers, and have showed my
> configs
> to several accomplished Apache jocks.  Always the same reply, "This
> ought to work."
> 
> I know the file is being found b/c I change the name and the error
> message changes to "File not found."
> 
> I'm not sure what reward I could give, but eternal gratitude isn't to
> be
> taken lightly :-)
> 
> I won't burden anyone with further details, but will be glad to send
> oodles on request.
> 
> Thanks.
> 
> B.
> 

---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by James Harr <ja...@grickle.org>.
PHP has a version for apache 2.0

you need to use the --with-apxs2 option I believe. If you look under the
plugins directory, it should be there (it's been a while since I've
looked, so you may have to do some hunting).

Later,
jh

Mike Price said:
> Brian,
> I had the same problem. It turned out to be PHP.
> If you have PHP running, remove it and try again.
>
> I have not been able to get Apache 2.0/PHP/cgi
> to work together and am waiting for a version of PHP
> compatible with Apache 2.0.
>
> Mike
>
> --- Brian Capouch <br...@palaver.net> wrote:
>> Three days and three nights of "ScriptAlias" and
>> "ExecCGI" directives,
>> and any and all attempts I make to run a CGI script
>> fail, "Server Error:
>> Premature end of script headers."
>>
>> I have built and configured many 1.x servers, and
>> have showed my configs
>> to several accomplished Apache jocks.  Always the
>> same reply, "This
>> ought to work."
>>
>> I know the file is being found b/c I change the name
>> and the error
>> message changes to "File not found."
>>
>> I'm not sure what reward I could give, but eternal
>> gratitude isn't to be
>> taken lightly :-)
>>
>> I won't burden anyone with further details, but will
>> be glad to send
>> oodles on request.
>>
>> Thanks.
>>
>> B.
>>
>>
> ---------------------------------------------------------------------
>> 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! Tax Center - online filing with TurboTax
> http://taxes.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




---------------------------------------------------------------------
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: Change in CGI config for 2.0.x? @@!$!@$!#$

Posted by Mike Price <mj...@yahoo.com>.
Brian,
I had the same problem. It turned out to be PHP.
If you have PHP running, remove it and try again.

I have not been able to get Apache 2.0/PHP/cgi
to work together and am waiting for a version of PHP
compatible with Apache 2.0.

Mike

--- Brian Capouch <br...@palaver.net> wrote:
> Three days and three nights of "ScriptAlias" and
> "ExecCGI" directives,
> and any and all attempts I make to run a CGI script
> fail, "Server Error:
> Premature end of script headers."
> 
> I have built and configured many 1.x servers, and
> have showed my configs
> to several accomplished Apache jocks.  Always the
> same reply, "This
> ought to work."
> 
> I know the file is being found b/c I change the name
> and the error
> message changes to "File not found."
> 
> I'm not sure what reward I could give, but eternal
> gratitude isn't to be
> taken lightly :-)
> 
> I won't burden anyone with further details, but will
> be glad to send
> oodles on request.
> 
> Thanks.
> 
> B.
> 
>
---------------------------------------------------------------------
> 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! Tax Center - online filing with TurboTax
http://taxes.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