in reply to Apache reads scripts as html, not cgi
First of all, you need to post some code for anyone to get an idea of what the problem may be.
Second, there are several things you need to look for (oversimplified, but they should work):
- A shebang line at the top of the .cgi script, which on Win32 versions, looks something like this:
#!C:\perl\bin\perl5.6.1.exe
- In most cases, Apache will interpret /(forward slash, UNIX-style) symbols as \(backslash, Win32-style) for Win32, but I've found that this is not the case for the shebang line.
- Make sure you are sending the proper <FORM ACTION="script.cgi" METHOD=""> (assuming you're passing from another HTML document) through to the script in the request header. The METHOD needs to be a GET or POST request in order to work. Nearly any web page will have an example of a FORM tag. Heck, hit View Source now and do a search. I'll bet it's there somewhere.
- The AddHandler Directive recommended by blakem is also a good one for testing, but I've heard arguments against keeping this handler in place permanently. It came up in O'Reilly's CGI Programming With Perl, 2nd Ed., pp. 14-15. This directive allows any .cgi script which is accessible from the server to be run as a script. If a Bad Guy sees that scripts are run that are not in the /cgi-bin/ directory, he may try to look for a file called "script.bak", or "script.cgi~", which would be left behind by lots of text editors. He could then view the source code and exploit it. Maybe it's not a very likely scenario, but it's something to think about if you use CodeWright, Visual Studio, or even emacs! I would leave this handler in place just long enough to test the scripts.
If none of these helps at all, you'll need to post some code and snippets of your httpd.conf files.
Good luck!
MM
In Section
Seekers of Perl Wisdom