homepage Welcome to WebmasterWorld Guest from 54.234.74.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Form Mailer
Won't allow POST method
PerlNovice




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

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]

 

bunltd




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

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.

phranque




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

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.

PerlNovice




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

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?

phranque




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

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

PerlNovice




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

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?

rocknbil




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

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,

Start->Run

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.

PerlNovice




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

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 ;-)

Cheers,
PN

PerlNovice




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

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.

rainborick




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved