httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leif W" <>
Subject Re: [users@httpd] Help needed with Apache 2 on RH9
Date Wed, 22 Oct 2003 20:09:00 GMT
----- Original Message ----- 
From: "Dave Brooks" <>
To: "apache_list" <>
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

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.  :-)


> Well, this is a last-ditch effort.  I've been working on this for days and
> 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
> 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
> 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
> 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
> place and is not truly the normal header issue.  Also, I can execute the
> 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
> 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
> 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
> "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
> if anyone has any suggestions it would be greatly appreciated.
> Thanks
> Dave
> --------------------------------------------------------------------------
> -----
> DevBox : An Open Community Development Server
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:> for more info.
> To unsubscribe, e-mail:
>    "   from the digest:
> For additional commands, e-mail:

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message