Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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 reply to Re: Apache reads scripts as html, not cgi by Maestro_007
in thread Apache reads scripts as html, not cgi by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found