CGI script not working


#1

Hi,
i want this cgi script to be executed everytime, and i followed Dreamhost’s wiki steps to do so. But it isn’t enough…
i made a cgi-bin directory inside my public folder, i placed the script there, even created an .htaccess file with the Options +ExecCGI directive, but it doesn’t work
the directory and file have been properly chmodded… what can be happening?
Please help. :frowning:


#2

Hi antilope, I’m having the same problem – followed all the instructions in wiki but still getting 500 errors. There must be some configuration somewhere I’m missing. (But where??) Did you ever figure this out?
-Jason


#3

The most common cause of CGI scripts failing to run is having the script saved with DOS/Windows style line endings (CR+LF). Check in your text editor… they need to be set to UNIX line endings (LF).


#4

Thanks for the suggestion!

In my case I’d just forgotten that cgi script output needs the Content-type header. The simplest test.cgi script is thus:

#!/bin/sh
echo "Content-type: text/plain"
echo
echo “test”

Ironically, if I had been testing using my real cgi scripts it would’ve worked just fine! :slight_smile:

(Thanks to some support lady named Jennifer for pointing out my stupid mistake!)

-Jason