All cgis Premature End of Script Headers

2 posts / 0 new
Last post
#1 Thu, 11/22/2012 - 10:51
manfer

All cgis Premature End of Script Headers

I'm totally stack on what can be the source of this problem.

I was trying to use gitweb and I found a 500 internal server error. On tracking the error I have discovered that not only that cgi script is not working but is all cgi scripts on the server that actually doesn't work with a 500 internal server error.

The only thing I can obtain from the logs is from the virtual server error log:

Premature end of script headers: test.cgi

The problem is not on the cgi at all as I have just tested with a hello world script, so it seems something is failing or something is blocking the execution of cgi (perl in this case) scripts before even they start execution.

Not any other logs show anything. suexec.log shows nothing related.

The virtual server runs as Fcgid and the apache configuration looks fine to me:

SuexecUserGroup "#xxx" "#xxx"
ServerName xxxxxxx.xxx
ServerAlias www.xxxxxxx.xxx
ServerAlias webmail.xxxxxxx.xxx
ServerAlias admin.xxxxxxx.xxx
DocumentRoot /home/xxxxxxx/public_html
ErrorLog /var/log/virtualmin/xxxxxxx.xxx_error_log
CustomLog /var/log/virtualmin/xxxxxxx.xxx_access_log combined
ScriptAlias /cgi-bin/ /home/xxxxxxx/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/xxxxxxx/public_html>
Options -Indexes +ExecCGI +FollowSymLinks +IncludesNOEXEC
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/xxxxxxx/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/xxxxxxx/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/xxxxxxx/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.xxxxxxx.xxx
RewriteRule ^(.*) https://xxxxxxx.xxx:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.xxxxxxx.xxx
RewriteRule ^(.*) https://xxxxxxx.xxx:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 10000
FcgidMaxRequestLen 1073741824
RedirectMatch /cgi-bin/mailman/([^/\.]*)(.cgi)?(.*) https://xxxxxxx.xxx:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
RedirectMatch /mailman/([^/\.]*)(.cgi)?(.*) https://xxxxxxx.xxx:10000/virtualmin-mailman/unauthenticated/$1.cgi$3
Alias /pipermail /var/lib/mailman/archives/public
Alias /dav /home/xxxxxxx/public_html
<Location /git>
DAV on
AuthType Basic
AuthName xxxxxxx.xxx
AuthUserFile /home/xxxxxxx/etc/git.basic.passwd
Require valid-user
Satisfy All
RedirectMatch ^/git$ http://xxxxxxx.xxx/git/gitweb.cgi
RedirectMatch ^/git/$ http://xxxxxxx.xxx/git/gitweb.cgi
RewriteEngine off
AddHandler cgi-script .cgi
</Location>
<Location /dav>
DAV on
AuthType Basic
AuthName "xxxxxxx.xxx"
AuthUserFile /home/xxxxxxx/etc/dav.digest.passwd
Require user xxxxxxx
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
RewriteEngine off
<Limit POST PUT DELETE>
Require user xxxxxxx
</Limit>
</Location>

I don't know where to look for more clues about the problem.

Thu, 11/22/2012 - 21:33
andreychek

Howdy,

Well, that's a good start looking in the Apache logs.

I've occasionally seen FCGID not showing error messages (perhaps due to it's caching).

What you might want to do is go into Server Config -> Website Options, and change the PHP Execution Mode to "CGI".

After doing that, and accessing one of your scripts, do you see any errors in the Apache logs?

Also, make sure that the owner of your directory and script are the same as your Virtual Server owner, as that can cause problems if the're not.

-Eric

Topic locked