Web Hosting Talk







View Full Version : Problem with .cgi file functioning


WP1
11-20-2000, 02:03 PM
Hello,

This is my first time posting to this forum. I found out about "WebHostingTalk" from a post at SitePointForums.com (http://www.SitePointForums.com).

I am learning how to utilize CGI and I cannot get one of my "training" scripts to work on a particular webhost Xoasis.com (http://www.Xoasis.com). Every time I fill out the form and click submit, I am taken back to
the following URL,
http://www.xoasis.com/benefits.html

I have written them multiple times with now response. Cannot figure out what is going on. I will be posting separately about this problem with Xoasis and another host.

Please see the form on
http://jaja.xoasis.com/form.htm

The HTML for this form is,
<html>
<head>
<title> Submit Your Information </title>
</head>

<body bgcolor="#ffffff" text="#000000" id=all>

<h1> Submit Your Information </h1>
<p>
<form action="/cgi-bin/display.cgi" method="post" >
First Name: <input type="text" size="30" name="first"> <br>
City: <input type="text" size="30" name="city"> <br>
Favorite Food: <input type="text" size="30" name="food"> <br>
<P> <input type="submit" name="submit" value="Submit!">
<input type=reset name=reset value="Reset">
</form>

</body>
</html>

I uploaded a cgi file via ASCII. The name of the file is "display.cgi",

#!/usr/local/bin/perl

require "subparseform.lib";
&Parse_Form;

$name = $formdata{'name'};
$city = $formdata{'city'};
$food = $formdata{'food'};

print "Content-type: text/html\n\n";
print "Thank you, here is the information you entered: <br> ";
print " - First Name: $first <br> - City: $city <br> ";
print " - Favorite Food: $food";

I then went through the process of the "chmod" thing with the "display.cgi"
file and checked off the boxes
owner read, write, execute
group read, execute
other read, execute

This file should have a chmod of 755. When I check the "DirInfo" after
refreshing the files I get the following,
-rwxr-xr-x

I have also installed the "subparseform.lib" file within the CGI-BIN.

Please let me know If I am doing something wrong.

Thanks in advance,

WP

Deb Suran
11-20-2000, 02:15 PM
WP, telnet to your server and try running the program from the command line, and see if it generates any error messages. Also, double-check that you have the correct location of perl on your server.

BenS
11-20-2000, 02:26 PM
WP1,

The error is because your path to the cgi-bin file is incorrect. Xoasis.com set it up so that any error page goes to that default benefit page.
Change the url to http://jaja.xoasis.com/cgi-bin/display.cgi and you should be fine. *I think..*

WP1
11-20-2000, 02:40 PM
Hi,

Thank you both for your responses.

I replaced the url in the form as you suggested BenS and still got the error page.

Deb Suran, I do not think I can reach Xoasis.com via Telnet.

WP

BenS
11-20-2000, 02:43 PM
I said 'I think' ;)

Are you sure the file is in the cgi-bin? Is it named correctly?

When you go to: http://jaja.xoasis.com/cgi-bin/ you get the forbidden, which is fine. But when you go to: http://jaja.xoasis.com/cgi-bin/display.cgi you receive the 404 page (i.e. the benefits page).

Make sure that the page is named all lower case. UNIX is very sensitive about that..

Good luck

Wazeh
11-20-2000, 07:12 PM
WP1, the first thing I would try is to change the name of
the script from display.cgi to display.pl

On some systems this would work. If not, we will dig deeper into it.

ps. don't forget to change the <form> tag in the calling page to call display.pl instead of display.cgi