Forum Moderators: open

Message Too Old, No Replies

Form problem: "Method Post not allowed" after server change

Form unusable now

         

Jim Schuchert

1:02 am on Apr 22, 2006 (gmt 0)

10+ Year Member



I recently upgraded to a vdeck server from the cpanel server. All is well EXCEPT the form in which customers enter information when ordering my product is unusable now although there were no problems for last 5 years before the change. My hosting company's tech support has essentially told me it is my responsibility since I designed the site and the form, discounting the fact that the only change here is the server. However, they issued an 'incident report' so maybe someone will really look at it.

Apparently the use of Method "Post" in my HTML triggers the message "Method Post not allowed ..." or "I encountered an unrecoverable error..." when the 'Submit' button is clicked. Previously the form's contents were sent to a text file which was then sent to my email address. Without this ability, my small business is severely crippled. Has anyone had a similar experience? I would be willing to post my html if it would help. I hope I don't have to change web hosts but I think it has to be the new server and not my form. Any ideas or suggestions will be appreciated.

Jim

[edited by: encyclo at 1:06 am (utc) on April 22, 2006]
[edit reason] no discussion of specific hosts please, see forum charter [/edit]

encyclo

1:08 am on Apr 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Jim and welcome to WebmasterWorld!

If you are getting an error "Method Post not allowed", it sounds possibly like the script which is processing the form is not set as executeable. This could be either a permissions problem with the script itself or it could be that the directory does not allow executeable files.

Have you tried CHMOD 755 for the script? Which language does the script use? Perl?

Jim Schuchert

1:36 am on Apr 22, 2006 (gmt 0)

10+ Year Member



Thanks for the reply, encyclo. I don't know what chmod 755 is but somewhere on the host web site concerning form mail I say something that said use (?) 754. The script is only in text, the form in html.
Looks like this:
To:me@myemailaddress
From:[email]
Subject:Order Form Data

Name: [name]
Company: [company]
Address: [address]
City: [city]
State: [state]
Zip: [zip]
Telephone: [voice]
etc.
etc.

encyclo

1:42 am on Apr 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, but on the markup for your form, what is the line relating to the action:

<form [b]action="/cgi-bin/what-is-here.ext"[/b]>

Or in other words, what is generating the text file?

Jim Schuchert

2:37 am on Apr 22, 2006 (gmt 0)

10+ Year Member



<FORM Method="post" ACTION="cgi-bin/cgiemail/order_form.txt" >

tangor

1:38 pm on Apr 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Check your cgi-bin and make sure the form program is there. Check the path in your form to the cgi-bin. Not all servers are set up the same way.

rocknbil

3:16 pm on Apr 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<FORM Method="post" ACTION="cgi-bin/cgiemail/order_form.txt" >

Jim unless I'm missing something here, this is not possible, and this is why you are getting "post not allowed." You cannot post form data to a plain text file, it doesn't work that way. You post to an executable program, and the program performs the scripted tasks written into it - in this case store the info in the file, then email it to you.

I suggest you review your backup copies and see what changed, it should post to an executable script and the script should write to the file.

Additionally it would be helpful to know if your new server is a LINUX or MICROSOFT-based server. There **are** programs for MS-based servers that use the exact post method you have above, but the file orderform.txt is an email template, not the temp form data file, and is not even the actual path to the file - I cannot explain it better than that, but I don't think that's the problem.

Last comment - hopefully the email process of which you speak does not contain credit card data, email is not secure and this is a very dangerous method of operation.

encyclo

4:05 pm on Apr 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cgiemail

I assume that this is the MIT cgiemail script available here:

[web.mit.edu...]

The syntax looks correct, the script writes to the file specified after the slash. (There is some good documentation at the above link.)

It is widely available on many hosting packages. If you see the file in your cgi-bin directory, you need to check the file permissions and set it as an executeable file. How to do that depends on your FTP program, but most have a "CHMOD" option which you can use to set the file as "r+x" or "755".

If the file is absent or if the CHMOD doesn't work, the script may need to be reinstalled by you or your hosting company.

Jim Schuchert

4:11 pm on Apr 23, 2006 (gmt 0)

10+ Year Member



Tangor, thanks for the reply. It appears that the path is correct...cgi-bin has cgiemail and cgiemail has order_form.txt. I have now changed the path to the root (public_html) directory and the name to a blank text file named "formdata.txt. "

If I use "get" vs "post" the error message goes away and the form data appears in the address bar after clicking the 'Submit' button. So, the form data is being transferred but not going where I can use it, like to my email address.

Just read your last post about a 'text' file. In an earlier post on this thread I provided an abbreviated display of the order_form.txt file I have been using for several years with my former 'cpanel' server from my web host. It is a template that pairs up the data submitted with a value (in brackets). That information was then automatically emailed to me. I am not sure what an 'executable' file for the same process would be. Could you provide an example? I am confused because of the way it worked before. The error message from 'post' has now gone away since I changed the path and entered a file permission number. The web host help said to use 754 but I used 755. A tech said 754 doesn't make any sense. I appreciate your expertise here and hope you will continue to help me resolve the issue. I am going to church now but will check back later.

[edited by: encyclo at 5:40 pm (utc) on April 23, 2006]
[edit reason] no links to personal sites please, see forum charter [/edit]

Jim Schuchert

10:12 pm on Apr 23, 2006 (gmt 0)

10+ Year Member



Ok, here is what I have done after discovering that my cgiemail program had nothing in it. I followed the link about cgiemail which was very helpful.
1. Copied the contents of cgi-bin from my previous cpanel server. It contained cgiemail, cgiecho and a couple of other files. They were real files.
2. Put cgiemail and cgiecho into the cgi-bin directory.
3. Following code in my form: <form method ="post" Action="http://<my domain name>/cgi-bin/cgiemail/order_form.txt"
3a. I also have tried with only "cgi-bin/cgiemail/order_form.txt"
4. Order_form.txt is a template similar to instructions at the cgiemail site.
5. Changed permissions to 755

Each time I get a 500 Server error, but no more "Method post not allowed. What could be causing this? I will try a couple of the examples in the instructional site and see if they work.

Jim Schuchert

2:24 am on Apr 24, 2006 (gmt 0)

10+ Year Member



This is probably a stupid question but, as you must know by now, I am confused by the process. Is cgiemail the executable script that sends the form's data to the text file? If so, does the 'Action' key word tell cgiemail to do its thing and put the form's data into the text file? The problem seems to be in that 'text' file. BTW, I found out that the vdeck server is linux based. What does that do to my issue?

jdMorgan

3:08 am on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The text file is a 'template' file that contains, among other things, the e-mail address that the message is to be sent to. The script is executed, and uses that template by getting it's name from the server environment variables.

It's not clear how that script gets invoked, but in looking at the servers of several sites that use cgiemail, all of them are set up just like the documentation says. I suspect that on the POST, Apache executes the first cgi file it finds in the Action path, and not necessarily the 'file' at the end of that path.


<form method ="post" Action="http://<my domain name>/cgi-bin/cgiemail/order_form.txt"
------- Executes this -------------------------------------------^
------- Uses this e-mail template -----------------------------------------^

Again, it's not clear, but it does work as documented on several servers.

Jim

Jim Schuchert

3:48 am on Apr 24, 2006 (gmt 0)

10+ Year Member



Thank you jdmorgan for your input. So, if I understand you correctly, my html appears to be ok but it still gives me the dreaded 500 server error each time I execute it. How can I debug it? The only procedure I have used that actually works is (action="mailto:myaddress") but that's pretty awkward in viewing the results and is not too secure.

jdMorgan

4:17 am on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check your server error log -- All server errors are logged there, and the error report is often very specific.

The access log might also be useful if it contains anything really 'odd' -- Not too likely in this case.

I'd ping the host again on this one... Perhaps HTTP POSTs are not allowed to the cgi-bin directory due to an incorrect server configuration file, .htaccess, or 'control panel' setting.

You could code up a very simple 'hello world' script, and POST to that, both in cgi-bin and some other directory, just as a test (it can ignore the posted data, the point is juat to see if it executes). Simplify/reduce/divide/conquer, in other words.

Jim

tangor

4:28 am on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not to belabor the obvious, but MAKE SURE you've uploaded the cgi program in ASCI mode.

encyclo

12:30 pm on Apr 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the old and new servers have different operating systems then the file from the old server won't work on the new one - cgiemail is a compiled program and the binary needs to be compatible with the OS.

Do you have command-line (SSH) access to the new server? If so you could try recompiling the script. If not, what is the new server running, and which version? There may be a pre-compiled binary available on the MIT site.

Jim Schuchert

3:53 am on Apr 25, 2006 (gmt 0)

10+ Year Member



Sorry for the delay but I have been busy trying to resolve this thing. The support people at my web host essentially said (in a nice way) they can not get involved with coding. They said the path to my scripts may be wrong and that cgiemail should have an extension of ".cgi". Anyway, I have left that source and think I came up with a solution of my own. I found a "feedback" form example using html and a php script. I put all my queries in a 'textarea' and the user then entered his data opposite each label. I only had to edit a couple of lines in the php script so that the entire textarea was sent as 1 variable to create the form data. My code is 'Method = "post" action = "sendmail.php" ' It's really very slick. For now that will have to do. I also used the form mail build in the control panel from my web host and re-built my form but I don't care much for the way it displays the form data. In any event, until something better happens, I will use one of these solutions. I really want to thank those of you took the time to help me resolve my problem. I learned a lot and know where to come next time there is an issue. If I ever get an answer to the original problem, I will post it here. I now have a way to get the server error logs so perhaps that will help as someone recommended. Thanks again.