httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BAO RuiXian <>
Subject Re: [users@httpd] CGI + Virtual host difficulty
Date Sun, 25 Apr 2004 08:45:06 GMT

Charles Ulrich wrote:

>I'm having a problem setting up a virtual host to handle a Perl-driven CGI
>application. The problem: When accessing the virtual host, the server returns
>a 500 Internal Server Error. Upon inspecting the logs, the message given is
>the infamous "premature end of script headers." Nothing more. And I'm not
>sure how to proceed.

This error message means that either you don't have a correct header 
printed or some other messages have been printed before the the header. 
I can think of two reasons for this: one is, do you have the correct 
perl path in your index.cgi script? two, have you printed out the head 
information before any other information printed out such as

    print "Context-type: text/html\n\n"

something like this?



>The application is Bugzilla, but from my tests, it seems that it's not
>Bugzilla that is specifically the problem. I substituted the printenv scipt
>as distributed with Apache for Bugzilla's index.cgi and got the same results.
>The are other CGI applications configured as virtual hosts that work fine,
>but they all use PHP. I am using Apache 1.3.27, FreeBSD 4.9-STABLE, Perl
>5.00503, and Bugzilla 2.16.4 from ports but symlinked the directory to
>/www/vhosts/ where the rest of the virtual host files are stored on this
>server. Bugzilla's script reports everything as working
>properly. The hostname that I'm using, "bugs", is correctly configured in
>bind. Here is a copy of the (relevant) settings in httpd.conf:
>User www
>Group www
><Directory />
>    Options FollowSymLinks
>    AllowOverride None
>UseCanonicalName On
>DefaultType text/plain
><IfModule mod_mime.c>
>    AddHandler cgi-script .cgi
><VirtualHost *>
>    ServerAdmin
>    DocumentRoot /www/vhosts/
>    DirectoryIndex index.cgi
>    ServerName
>    <Directory /www/vhosts/>
>        Options ExecCGI
>        AllowOverride Limit
>    </Directory>
>    ServerAlias bugs
>    ErrorLog /var/log/
>    CustomLog /var/log/ common
>If there are any other directives that would be useful, PLEASE let me know.
>I ommited the DocumentRoot directive and its Directory directive since those
>settings don't seem to apply when everything on this server is literally a
>virtual host.
>Here is the output of the ONLY error message printed when trying to access
>the page:
>[Fri Apr 23 12:50:09 2004] [error] [client] Premature end of
>script headers: /www/vhosts/
>Now for some remedies that I have tried...
>I saw a recommendation somewhere on the web to comment out "Options ExecCGI"
>from the Directory directive, but that results in a 403 Forbidden error and
>the log says: "Options ExecCGI is off in this directory." So I assume that
>won't fix it. ;)
>As I mentioned before, I replaced Bugzilla's main script, index.cgi, with
>the printenv script bundled with Apache. The bangpath of printenv is
>identical to the one Bugzilla is using: /usr/bin/perl. The perl executable
>does indeed live in that location and is executable.
>I have double- and triple-checked that permissions and symlinks do not seem
>to be the problem.
>Any other suggestions or comments would be extremely helpful, welcome, and
>much appreciated.
>Charles Ulrich
>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