Article:
  Apache Web-Serving With Mac OS X, Part 5
Subject:   still having trouble with cgi
Date:   2002-03-15 21:50:12
From:   bdoltens
sorry, i posted this on part 4 already
Can someone please help me?
I can successfully run the test-cgi from my browser, but a downloaded perldiver.cgi will not run.
I desired to use /Users/bdoltens/Sites/cgi-bin as a folder for cgi scripts, so I made a
<Directory "/Users/bdoltens/Sites/cgi-bin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
just after the <Directory /> bit in httpd.conf. Addhandler cgi-script .cgi is uncommented. ScriptAlias is commented out.
by typing perl /Users/bdoltens/Sites/cgi-bin/perldiver.cgi in the terminal, the program runs and outputs good html. Still, the browser reports a 500 when I attempt to access the script.
i have chmoded the file as 755, or 775, and, not really understanding the specifics of chmod, i tried also "a+w," but nothing really works.
the error_log tells me two things,
(2)No such file or directory: exec of /Users/bdoltens/Sites/cgi-bin/perldiver.cgi failed
and then, premature script headers.
Thanks for listening. Great articles, even if I don't fix this it was fun using the terminal for something.
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Morbus Iff photo still having trouble with cgi
    2002-03-19 14:10:32  Morbus Iff | O'Reilly Author [View]

    You say the perldiver.cgi script outputs good HTML on the command line - but, but, but, when run as a CGI, it absolutely *needs* to output:

    "Content-type: text/html\n\n"

    before, before, before any other output to the browser. If you do not output that text, then the browser has no flipping clue what data is coming to it, so it will return an error) about premature script headers.

    Generically though, "premature script headers" could be any number of problems, only one of which could be missing that Content-type line. To further debug your problem, check out the various documents at Debugging Perl - About.com (but be prepared for tons of popup advertisements).