Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2003 18:35:00 +0100
From:      Olivier Dony <oli@studyssimo.be>
To:        FreeBSD-Questions <freebsd-questions@freebsd.org>
Subject:   mod_cgi not working at all/weird behaviour
Message-ID:  <20030316183500.A5276@naboo.blacktrap.net>

next in thread | raw e-mail | index | archive | help
Hello,

I posted a problem some days ago about POST data not being passed to my cgi 
perl scripts. This only happens on my FreeBSD4.7-RELEASE server. Well in the 
process of troubleshooting I noticed that if I disabled mod_gzip (which is 
the only thing I don't have on my other working servers) my scripts stopped
working completely with error 500.
I tried then to reinstall everything. So I deinstalled perl, apache and what
depends on it, deleted apache's conf file and reinstalled everything 
*but mod_gzip*. Well my cgi's aren't working a bit more than before!

Anything I put in a cgi script ends with an internal error 500, and in the
errorlog it always says : 
[Fri Mar 14 00:18:19 2003] [error] [client 212.68.212.45] Premature end of script headers: /home/oli/public_html/cgi-bin/test.cgi

*Anything*, meaning that it fails too with a basic script like this :

---
#!/bin/sh
echo "content-type: text/html"
echo "

<html><body>hello</body></html>"
---

(the empty line after content-type is there)
My scripts are done by hand using vim, so no binary ftp xfer involved.
All the scripts are chmod'd 0755, the containing directory too, and they give 
the expected output when run in the console.

This is with apache 1.3.27_4 from the ports, mod_php4 4.3.1, and perl base
or perl 5.6.1_11 from the ports (same result).
I've tried doing tests to output this basic thing with sh, perl, php, etc..
everything gives the same 500 error when executed through CGI, while working 
ok in the console!! 

And guess what, if I reinstall mod_gzip, as soon as it is enabled and set to
handle cgi-script with (mod_gzip_item_include mime ^text/html and
mod_gzip_item_include handler ^cgi-script$) the scripts start to work, ie they
give the expected output, but the first problem comes back : POST data is
always empty. So I had to change my scripts to use GET for submitting forms,
which is ugly and might even trigger query-string length problems I suppose.

I'm completely lost, this doesn't seem to make sense at all, but is probably
making sense if I knew where to look... The rest of the webserver is doing 
fine, basic html files and php are working ok, even with POST data! 
How could mod_gzip make my cgi scripts work, but only partly, and how come 
they aren't working at all without it, when working ok on my other FreeBSD 
webservers ??

Could someone help me or advice me before I completely lose my poor mind? ;-)
I've tried to reinstall everything, change permissions etc.. 
Always the same result...

Thanks a lot in advance if someone can provide any sort of help!

Olivier

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030316183500.A5276>