Hi people.

I'm having alot of problems with a peice of CGI mail form that I'm trying to use.

Everytime I click send I get a 405 error. I have been led to believe that it generally means I have a permission problem.

I've checked the permissions on the CGI-BIN folder they are 777, and the cgiform.cgi is set to 777.

Could anybody give me any other reasons why I get a 405 error. the for is here.

Cheers.

Leroy

Dani AI

Generated

A 405 is an HTTP "Method Not Allowed" response — the server is refusing the HTTP method (often POST) for the URL. reported that when the form is submitted it returns a 405, while saw a 404 in their tests. That difference is useful: 404 means "wrong URL or missing resource"; 405 means the resource exists but the server will not accept the request method. See MDN for the standard explanation: 405 Method Not Allowed.

Practical steps to pin the problem down (run these from a shell):

curl -i -X POST -d 'test=1' 'http://your.site/path/to/action.cgi'
curl -i -X OPTIONS 'http://your.site/path/to/action.cgi'   # look for an Allow: header
sudo tail -n 200 /var/log/apache2/error.log                # or /var/log/httpd/error_log
apachectl -M                                              # check loaded modules (mod_cgi, mod_security, etc.)

What to check next, and how to test each hypothesis:

  • Confirm the action URL really points to the script (404 vs 405 diagnosis).
  • Test a tiny known-good CGI (one-line shell script that prints "Content-Type: text/plain" and a body). If that fails for POST, it is a server/config issue; if it works, the original script has a problem.
  • Ensure Apache treats the file as a CGI: either the file is in a ScriptAlias cgi-bin or the directory has Options +ExecCGI and AddHandler cgi-script .cgi enabled. See Apache mod_cgi docs: mod_cgi.
  • Look for .htaccess or <Limit>/<LimitExcept> rules denying POST, or mod_security/mod_evasive rules blocking the request (check their logs).
  • Check ownership, SELinux context, and avoid world-writable permissions; suEXEC/CGI wrappers can refuse execution for bad ownership.
  • Confirm the shebang and Unix line endings; run the script from the shell to see runtime errors.

Recommended order: reproduce with curl, read Apache error_log, try the minimal CGI, then inspect Apache config and security modules. Increasing LogLevel temporarily will often show the root cause quickly.

I get a 404 instead of a 405? :?:
Check to see you have the correct URL to the CGI script ~

lol 405 never seen before

There is a 405 error, but not common.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.