Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Form Mailer

Won't allow POST method



11:58 pm on Aug 4, 2008 (gmt 0)

5+ Year Member

Very new to all of this. Had a form running through a third party but I decided to try and have my own and cut out the advertising. Got the form mailer script from Matt's Script Archives and (hopefully!) configured it.

ASCII FTP'd the script into the cgi-bin folder & chmod 755.

Problem is that when I test the form and click 'Submit' I get a
405 - Method not allowed
The requested method POST is not allowed for the URL /cgi-bin/formmail.pl.

Site host says that script help is not within the realm of their service.

Any help would be much appreciated. Thanks.

[edited by: phranque at 8:11 am (utc) on Aug. 5, 2008]
[edit reason] removed specifics [/edit]


1:52 am on Aug 5, 2008 (gmt 0)

10+ Year Member

Are you sure your account with your host allows the execution of cgi scripts? That sort of error would tend to mean that on an Apache host.

If you can't run cgi on your account, you might try the php route.


8:18 am on Aug 5, 2008 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

welcome to WebmasterWorld [webmasterworld.com], PerlNovice!

you could try '... method="GET" ...' in your form tag and see if that works.
whether your "action" script is php or perl, the POST method problem will be similar.
there are some restrictions to using the GET method so it may not work in your case or the script may not be equipped to handle the GET method.


9:46 am on Aug 5, 2008 (gmt 0)

5+ Year Member

OK, thanks for the help so far.

As an update my host pointed me to resetting the scripting which I did and then tried one of their cgi scripts which worked so cgi scripting seems to be ok. Mine (i.e. Matt's) still throws an error albeit a different one now. (Their script simply sends an e-mail to a specified address when a link is clicked. There is no POST/GET method in it.) I now get 500 internal server error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

I have tried changing the method to GET and changing the script from .pl to .cgi but still get the error. Is it my problem that people here can help with or is it on the host's server?


9:49 am on Aug 5, 2008 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

have you checked for an error message in the server error log?


10:14 am on Aug 5, 2008 (gmt 0)

5+ Year Member

Usually this is the bit where it all starts to turn into a foreign language to me. The last entry in the error log file says;

[error] [client ipaddress] Premature end of script headers: /home/fhlinux153/j/dominname/user/htdocs/cgi-bin/formmail.pl

Afraid this doesn't mean much to me?


5:29 pm on Aug 5, 2008 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Something you are going to need if you play in perl - download perl to your local computer. Google for ActivePerl for the easiest install.

Once done,


type cmd, press enter.

Navigate to where the script is:

cd\ [enter] brings you to the root of your local H.D.

cd whatever\directories\to\directory\containing\script [enter]

perl formmail.pl [enter]

This is the first step, test that bugger offline. If you can SSH to the server, repeat the command line process. Get it running via command line first, then figure out what the totally useless errors mean. :-)

We won't get into how vulnerable the scripts from Matt's Archives are - M.S.A. is a good way to get your feet wet in perl. Eventually you'll want to switch to something else, or write your own. Just be aware that this mailer may give you more problems than it's worth.


10:09 pm on Aug 5, 2008 (gmt 0)

5+ Year Member

Many thanks to all for all your help and advice, it is very much appreciated. Script still isn't working but host have now passed the problem onto a senior engineer to resolve so I'll leave you guys in peace, for now ;-)



11:32 pm on Aug 5, 2008 (gmt 0)

5+ Year Member

Just for final closure, it works now. I installed ActiveState's ActivePerl and ran the script from command prompt. It pointed out that there was an invalid character. I edited the script from the command prompt and could see from there that a '^ had been transposed to some gibberish. Corrected that and ran it again and all was well. Uploaded the edit script and it works.

Thanks again you guys for all your help.


4:44 pm on Aug 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Just an FYI, 'Premature end of script headers' almost always means one of two things: (1) there's a syntax error in the script, or (2) the permissions on the script file are not set to 755 to allow execution.

Featured Threads

Hot Threads This Week

Hot Threads This Month