Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Method Not Allowed

by moath (Initiate)
on Oct 25, 2000 at 08:31 UTC ( #38291=categorized question: print w/replies, xml ) Need Help??
Contributed by moath on Oct 25, 2000 at 08:31 UTC
Q&A  > CGI programming


I've got a script that SHOULD accept input from a form using the POST method. However, I keep getting "Method Not Allowed" error. The error code is 405. Is this just a misconfiguration in Apache, or is there something wrong with my script. The script is a big large to post, but what can you tell from what I've said thus far?

Answer: Method Not Allowed
contributed by extremely

Sounds like Apache to me. It is a straight CGI I assume and not a mod_perl Registry script. I'd bet on a line like

<Location />
  Deny all
in your config...
Answer: Method Not Allowed
contributed by Fastolfe

This sounds like your script is not in a directory recognized by your web server as a CGI directory (such as /cgi-bin/). If you're attempting to put Perl scripts anywhere in your document hierarchy, be certain your web server is set up to handle files of that extension as a CGI script. For example, with Apache, place this in the relevant <Directory> or <Location> blocks, or if you don't care to localize the effect, anywhere else will do:

AddHandler cgi-script .pl
The problem stems from the fact that your script may be being interpreted as a plain document, which cannot be POSTed to. You have to tell the server to interpret that file as a CGI script instead of a document, which involves placing it in a directory set up for CGI scripts, or telling the server that documents with that extension/MIME type should be treated as CGI scripts.
Answer: Method Not Allowed
contributed by AgentM

Take one step at a time- test a bland CGI like this:

use CGI qw/:standard/; print '<html><head><body>hi';
Then you're SURE to find out where the error is (since it's not in the bland CGI).

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (5)
    As of 2020-08-08 04:45 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (51 votes). Check out past polls.