You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dave Brooks <ma...@twcny.rr.com> on 2003/10/21 00:47:12 UTC

[users@httpd] Help needed with Apache 2 on RH9

Hi there...

Well, this is a last-ditch effort.  I've been working on this for days and I
don't seem to be getting anywhere.
I hope someone will have some insight to offer.

A short time back, I migrated from RH7.2 to 9.0 and upgraded to Apache 2
from the 1.3 series. So as not to mislead anyone...I didn't simply "upgrade"
existing systems...I actually built a new box, did the installations and
then migrated data.


Ever since the upgrade I have been unable to configure apache to allow users
their own cgi-bin. The user web space works fine, a few users are running
web sites without any issues, this is strictly a cgi-bin issue:

Any cgi moved to any user cgi-bin fails to run with the following error
logged:

quote:
----------------------------------------------------------------------------
----
[Sun Oct 19 11:56:10 2003] [error] [client *.*.*.*] Premature end of script
headers: testme.cgi
----------------------------------------------------------------------------
----
(I edited out the IP for this post, that's not in the log like that)


Now... I can take the SAME *.cgi and mv it to the server's cgi-bin and it
works fine.   This tells me that I have the applicable "\n\n" in the proper
place and is not truly the normal header issue.  Also, I can execute the cgi
in the cgi-bin from command line, so I can rule out faulty code.  I should
also mention that I only work with C or C++ cgi's, so paths to perl or bash
are irrelevant.

To rule out permission issues, I chmod'd to 777  (both the cgi and the
directory
the owner of the bin is the user and the group is the httpd group

here are the applicable entries in the config:
quote:
----------------------------------------------------------------------------
----

<IfModule mod_userdir.c>
UserDir WWW
UserDir disabled root
</IfModule>

<Directory /home/*/WWW>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order allow,deny
Allow from all
</LimitExcept>
</Directory>

<Directory /home/*/WWW/cgi-bin>
Options ExecCGI
AddHandler cgi-script .cgi .pl
</Directory>

----------------------------------------------------------------------------
----

*someone mentioned that the "Options ExecCGI" line should actually read as:
"Options +ExecCGI",
but that didn't seem to make any difference.


I've been banging my head against the wall with this for a couple days now,
if anyone has any suggestions it would be greatly appreciated.

Thanks

Dave
malloc@twcny.rr.com
----------------------------------------------------------------------------
-----
DevBox : An Open Community Development Server
http://www.devbox.us


---------------------------------------------------------------------
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


Re: [users@httpd] Help needed with Apache 2 on RH9

Posted by Dave Brooks <ma...@twcny.rr.com>.
Hi Leif...

> Hi!  I see no one responded so I was unsucessfully trying to duplicate the
> error.  I'm on Debian, not Redhat though.  I set up a VirtualHost with
this
> similar Directory block in there.


Thank you for all of the suggestions.  The test code is a simple hello
world, but I did
change the "\n\n" to "\r\n".

ScriptAlias /cgi-bin/ "/home/*/WWW/cgi-bin/"

the above line was missing, so I added that and restarted the server.  The
code
still returned the premature headers error.  I moved the code to the main
cgi-bin
(under /var) and it worked fine.

I changed the *.cgi extention to *.pl and then to *.bob... (adding the
proper handlers)
and there was no change.

oh... I also made sure all directory structures were in double quotes.

could this be a bug in apache or apache + RH9  ??

thanks again for all your help!


Dave





>     <Directory "/path/to/web/site/cgi-bin">
>         Options ExecCGI
>         AddHandler cgi-script .cgi
>         AllowOverride AuthConfig
>         Order allow,deny
>         Allow from all
>     </Directory>
>
> Then I wrote a very simple C program.  I had at first tried two times
> "\r\n", as I believe that is the proper character sequence after the
> headers, and then tried just two "\n" to see if it broke anything.  Have
you
> ruled out the code by using such a simple program as this?
>
> /*
>  * hw.c
>  *
>  * Hello World cgi-bin program
>  */
>
> #include <stdio.h>
>
> int main ( void )
> {
>     // printf( "Content-Type: text/plain\r\n" );
>     // printf( "\r\n" );
>     printf( "Content-Type: text/plain\n" );
>     printf( "\n" );
>     printf( "Hello World!\n" );
>
>     return( 0 );
> }
>
> I wasn't sure if the .cgi extension was somehow being treated like a perl
> script by Apache, so I expected the AddHandler cgi-script .cgi to be
causing
> the problems, but I was apparently incorrect, as this didn't have any ill
> effects.  But just to rule out this on your server, have you tried
renaming
> the file to something without a .cgi ending, just to see what might
happen?
> My sample program runs fine for me when I rename from hw.cgi to hw.  The
> Options ExecCGI is usually sufficient.  It says that any request to a file
> in this directory should get executed as if it were a program.  The
> AddHandler is usually another technique used to allow Perl scripts to run
> outside of the cgi-bin, so it shouldn't really be necessary.  Also, I
didn't
> see any ScriptAliasMatch directive for that "/home/*/WWW/cgi-bin".  Also
> note, you should put your Directory "/paths" in double quotes.
>
> So maybe try some other things.  If anyone else has suggestions feel free
to
> chime in.  :-)
>
> Leif
>
> > Well, this is a last-ditch effort.  I've been working on this for days
and
> I
> > don't seem to be getting anywhere.
> > I hope someone will have some insight to offer.
> >
> > A short time back, I migrated from RH7.2 to 9.0 and upgraded to Apache 2
> > from the 1.3 series. So as not to mislead anyone...I didn't simply
> "upgrade"
> > existing systems...I actually built a new box, did the installations and
> > then migrated data.
> >
> >
> > Ever since the upgrade I have been unable to configure apache to allow
> users
> > their own cgi-bin. The user web space works fine, a few users are
running
> > web sites without any issues, this is strictly a cgi-bin issue:
> >
> > Any cgi moved to any user cgi-bin fails to run with the following error
> > logged:
> >
> > quote:
>
> --------------------------------------------------------------------------
> --
> > ----
> > [Sun Oct 19 11:56:10 2003] [error] [client *.*.*.*] Premature end of
> script
> > headers: testme.cgi
>
> --------------------------------------------------------------------------
> --
> > ----
> > (I edited out the IP for this post, that's not in the log like that)
> >
> >
> > Now... I can take the SAME *.cgi and mv it to the server's cgi-bin and
it
> > works fine.   This tells me that I have the applicable "\n\n" in the
> proper
> > place and is not truly the normal header issue.  Also, I can execute the
> cgi
> > in the cgi-bin from command line, so I can rule out faulty code.  I
should
> > also mention that I only work with C or C++ cgi's, so paths to perl or
> bash
> > are irrelevant.
> >
> > To rule out permission issues, I chmod'd to 777  (both the cgi and the
> > directory
> > the owner of the bin is the user and the group is the httpd group
> >
> > here are the applicable entries in the config:
> > quote:
>
> --------------------------------------------------------------------------
> --
> > ----
> >
> > <IfModule mod_userdir.c>
> > UserDir WWW
> > UserDir disabled root
> > </IfModule>
> >
> > <Directory /home/*/WWW>
> > AllowOverride FileInfo AuthConfig Limit
> > Options MultiViews Indexes SymLinksIfOwnerMatch
> > <Limit GET POST OPTIONS>
> > Order allow,deny
> > Allow from all
> > </Limit>
> > <LimitExcept GET POST OPTIONS>
> > Order allow,deny
> > Allow from all
> > </LimitExcept>
> > </Directory>
> >
> > <Directory /home/*/WWW/cgi-bin>
> > Options ExecCGI
> > AddHandler cgi-script .cgi .pl
> > </Directory>
> >
>
> --------------------------------------------------------------------------
> --
> > ----
> >
> > *someone mentioned that the "Options ExecCGI" line should actually read
> as:
> > "Options +ExecCGI",
> > but that didn't seem to make any difference.
> >
> >
> > I've been banging my head against the wall with this for a couple days
> now,
> > if anyone has any suggestions it would be greatly appreciated.
> >
> > Thanks
> >
> > Dave
> > malloc@twcny.rr.com
>
> --------------------------------------------------------------------------
> --
> > -----
> > DevBox : An Open Community Development Server
> > http://www.devbox.us
> >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> 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
>


---------------------------------------------------------------------
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


Re: [users@httpd] Help needed with Apache 2 on RH9

Posted by Leif W <wa...@usa.net>.
----- Original Message ----- 
From: "Dave Brooks" <ma...@twcny.rr.com>
To: "apache_list" <us...@httpd.apache.org>
Sent: Monday, October 20, 2003 6:47 PM
Subject: [users@httpd] Help needed with Apache 2 on RH9


> Hi there...

Hi!  I see no one responded so I was unsucessfully trying to duplicate the
error.  I'm on Debian, not Redhat though.  I set up a VirtualHost with this
similar Directory block in there.

    <Directory "/path/to/web/site/cgi-bin">
        Options ExecCGI
        AddHandler cgi-script .cgi
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>

Then I wrote a very simple C program.  I had at first tried two times
"\r\n", as I believe that is the proper character sequence after the
headers, and then tried just two "\n" to see if it broke anything.  Have you
ruled out the code by using such a simple program as this?

/*
 * hw.c
 *
 * Hello World cgi-bin program
 */

#include <stdio.h>

int main ( void )
{
    // printf( "Content-Type: text/plain\r\n" );
    // printf( "\r\n" );
    printf( "Content-Type: text/plain\n" );
    printf( "\n" );
    printf( "Hello World!\n" );

    return( 0 );
}

I wasn't sure if the .cgi extension was somehow being treated like a perl
script by Apache, so I expected the AddHandler cgi-script .cgi to be causing
the problems, but I was apparently incorrect, as this didn't have any ill
effects.  But just to rule out this on your server, have you tried renaming
the file to something without a .cgi ending, just to see what might happen?
My sample program runs fine for me when I rename from hw.cgi to hw.  The
Options ExecCGI is usually sufficient.  It says that any request to a file
in this directory should get executed as if it were a program.  The
AddHandler is usually another technique used to allow Perl scripts to run
outside of the cgi-bin, so it shouldn't really be necessary.  Also, I didn't
see any ScriptAliasMatch directive for that "/home/*/WWW/cgi-bin".  Also
note, you should put your Directory "/paths" in double quotes.

So maybe try some other things.  If anyone else has suggestions feel free to
chime in.  :-)

Leif

> Well, this is a last-ditch effort.  I've been working on this for days and
I
> don't seem to be getting anywhere.
> I hope someone will have some insight to offer.
>
> A short time back, I migrated from RH7.2 to 9.0 and upgraded to Apache 2
> from the 1.3 series. So as not to mislead anyone...I didn't simply
"upgrade"
> existing systems...I actually built a new box, did the installations and
> then migrated data.
>
>
> Ever since the upgrade I have been unable to configure apache to allow
users
> their own cgi-bin. The user web space works fine, a few users are running
> web sites without any issues, this is strictly a cgi-bin issue:
>
> Any cgi moved to any user cgi-bin fails to run with the following error
> logged:
>
> quote:
> --------------------------------------------------------------------------
--
> ----
> [Sun Oct 19 11:56:10 2003] [error] [client *.*.*.*] Premature end of
script
> headers: testme.cgi
> --------------------------------------------------------------------------
--
> ----
> (I edited out the IP for this post, that's not in the log like that)
>
>
> Now... I can take the SAME *.cgi and mv it to the server's cgi-bin and it
> works fine.   This tells me that I have the applicable "\n\n" in the
proper
> place and is not truly the normal header issue.  Also, I can execute the
cgi
> in the cgi-bin from command line, so I can rule out faulty code.  I should
> also mention that I only work with C or C++ cgi's, so paths to perl or
bash
> are irrelevant.
>
> To rule out permission issues, I chmod'd to 777  (both the cgi and the
> directory
> the owner of the bin is the user and the group is the httpd group
>
> here are the applicable entries in the config:
> quote:
> --------------------------------------------------------------------------
--
> ----
>
> <IfModule mod_userdir.c>
> UserDir WWW
> UserDir disabled root
> </IfModule>
>
> <Directory /home/*/WWW>
> AllowOverride FileInfo AuthConfig Limit
> Options MultiViews Indexes SymLinksIfOwnerMatch
> <Limit GET POST OPTIONS>
> Order allow,deny
> Allow from all
> </Limit>
> <LimitExcept GET POST OPTIONS>
> Order allow,deny
> Allow from all
> </LimitExcept>
> </Directory>
>
> <Directory /home/*/WWW/cgi-bin>
> Options ExecCGI
> AddHandler cgi-script .cgi .pl
> </Directory>
>
> --------------------------------------------------------------------------
--
> ----
>
> *someone mentioned that the "Options ExecCGI" line should actually read
as:
> "Options +ExecCGI",
> but that didn't seem to make any difference.
>
>
> I've been banging my head against the wall with this for a couple days
now,
> if anyone has any suggestions it would be greatly appreciated.
>
> Thanks
>
> Dave
> malloc@twcny.rr.com
> --------------------------------------------------------------------------
--
> -----
> DevBox : An Open Community Development Server
> http://www.devbox.us
>
>
> ---------------------------------------------------------------------
> 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
>
>
>



---------------------------------------------------------------------
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