Newbie question

I’ve read as much as I can, until my eyes are about to bleed. I’m new to CGI programming, but technical.

I can’t get my PERL script to run from a form for anything. If I call it with a ‘POST’ I get this error:

“The requested method POST is not allowed for the URL /cgi-bin/test.cgi”

If I try it with a ‘GET’, it just displays the script in the browser. Permissions are 755 on the script and the cgi-bin directory. If I run the script from the command line, it seems to work ok. Right now, I’m just working with a simple script and html that I found in a tutorial

I’m new to Dreamhost, but it’s my understanding that all the plans have CGI enabled. I’m stumped! I’d appreciate any help. I’m sure it something dumb.

how do you have your form action set up in the html file?

Here’s the code:

Enter a year:

Enter a year:

When I started having problems with my code and the POST method, I found this html and started playing with it…


Try using the following

Enter a Year:

I get the same thing as before, when I try GET - the perl code is displayed in the browser…

Problem solved. I contacted DreamHost support and they said that CGI wasn’t enabled for my domain. I had looked if that was needed myself within the panel, but didn’t see anything. So, I assumed it was enabled automatically. Guess not.

It could be your script then. Can you post the code in here?

But, when the code shows in the browser upon execution, it usually means your web server has not been configured to execute CGI scripts in that folder and/or with that file extension. Which providing you are hosting with dreamhost, I doubt that is the case.

You can try to change your .cgi to .pl, repload and re site chmod 755 the .pl file.

Make sure your .html file is not in the same folder as your script.

Other than that, it could be your code, and I am not good at troubleshooting code. But I know there are some good coders in here.

Good Luck