- is it the host or is it me?
- Posted by freemont on March 10th, 2006
Hello all.
I started an account with godaddy that includes CGI support. The scripts
must reside within the /cgi folder they created. The shebang line they
require is /usr/bin/perl.
I cannot get anything to work. I am new to this, having only used perl
before in a classroom. When my new code failed at godaddy, I tried putting
some of the old classroom code up there for troubleshooting. Very simple
stuff, passing some pairs to the script to be output in an htm file.
Is there any reason that this code:
#!/usr/bin/perl
#spanish.cgi - creates a dynamic Web page
print "Content-type: text/html\n\n";
use CGI qw(:standard);
use strict;
#create Web page
print "<HTML>\n";
print "<HEAD><TITLE>Jackson Elementary School</TITLE><BASEFONT
SIZE=5></HEAD>\n"; print "<BODY>\n";
print param('trans'),"\n";
print "</BODY>\n";
print "</HTML>\n";
would not execute correctly from this page:
<HTML>
<HEAD><TITLE>Jackson Elementary School</TITLE><BASEFONT SIZE=5></HEAD>
<BODY>
Click an English word to display its Spanish equivalent<BR><br> <A
HREF="cgi/spanish.cgi?trans=Hola">Hello</A><BR> <A
HREF="cgi/spanish.cgi?trans=Adios">Good-bye</A><BR> <A
HREF="cgi/spanish.cgi?trans=Amor">Love</A><BR> <A
HREF="cgi/spanish.cgi?trans=Gato">Cat</A><BR> <A
HREF="cgi/spanish.cgi?trans=Perro">Dog</A><BR> </BODY>
</HTML>
This is the simplest example I could find. All it produces from godaddy
is:
"Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request." And so on. Nothing helpful.
I appreciate any help.
--
"Because all you of Earth are idiots!"
¯`ˇ.¸¸.ˇ´¯`ˇ-> freemontŠ <-ˇ´¯`ˇ.¸¸.ˇ´¯
- Posted by arccos on March 10th, 2006
freemont wrote:
Perl can be a bit tricky to debug through CGI. Someone else can
probably point you to documentation on how to enable debugging through
the web page. What I used to do is look at my error log and see what
that would have.
As far as troubleshooting the code itself, start with the simplest page
you can, and work your way up. In this case, I would say try removing
the print param line. If that doesn't work, try a simple hello world
script, and see if that works.
It's been awhile since I did Perl, so I can't be much more of a help,
sorry. :-)
-Arccos
- Posted by Brian Wakem on March 10th, 2006
freemont wrote:
That should be:
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $q = new CGI;
print $q->header();
Would be better written:
my $trans = $q->param('trans') || q!'trans' is undef!;
print <<HTML;
<HTML>
<HEAD>
<TITLE>Jackson Elementary School</TITLE>
<BASEFONT SIZE=5>
</HEAD>
<BODY>
$trans
</BODY>
</HTML>
HTML
Change as above. Any remaining errors will be printed to the browser.
If you still get Internal Server Error, make sure the permissions are
suitable and check your error log.
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
- Posted by Gordon Hudson on March 10th, 2006
"freemont" <yabba@dabba.doo> wrote in message
news
an.2006.03.10.18.33.15.699050@dabba.doo...
I find it easier to use a desktop development environment for writing perl.
I used to use a text editor.
I now use a thing called Optiperl which will run the activestate perl from
within it in a window so you can see the output.
This is a lot easier than the way I used to do it which was editing it live
on the server.
Optiperl points out obvious errors like missing semicolons or bad loops.
It makes coding a bit more of a pleasure and not something I try to put off
until its desperate.
Its worth looking at the various products like this if you are going to do
any more perl.
--
Gordon Hudson || Hostroute.com Ltd
e-mail:ghudson [at] hostroute.net
http://www.hostroute.com/resellers Host 5 web sites for $9 per month
http://www.nameroute.com/ Domain Names with free hosting and email $15
- Posted by SmakDaddy on March 10th, 2006
"freemont" <yabba@dabba.doo> wrote in message
news
an.2006.03.10.18.33.15.699050@dabba.doo...
FTP in and CHMOD the script to 755
Still a problem?
Send the url.
- Posted by freemont on March 10th, 2006
On Fri, 10 Mar 2006 19:08:09 +0000, Brian Wakem wrote:
I used your script and got the same error. The permissions are correct
(755).
I don't see a problem. I think godaddy is to blame, despite the claims of
the "help" twit I spoke to earlier.
Thank you for your time.
--
"Because all you of Earth are idiots!"
¯`ˇ.¸¸.ˇ´¯`ˇ-> freemontŠ <-ˇ´¯`ˇ.¸¸.ˇ´¯
- Posted by freemont on March 10th, 2006
On Fri, 10 Mar 2006 19:33:43 +0000, Gordon Hudson wrote:
Thank you, Gordon. This is a Linux box but when I boot to Windows later to
game a little, I'll grab the trial of Optiperl and have a look!
--
"Because all you of Earth are idiots!"
¯`ˇ.¸¸.ˇ´¯`ˇ-> freemontŠ <-ˇ´¯`ˇ.¸¸.ˇ´¯
- Posted by freemont on March 10th, 2006
On Fri, 10 Mar 2006 11:40:02 -0800, SmakDaddy wrote:
The permissions were already correct.
This is this testing page I'm using:
http://freemontsoffice.com/spanish.html
And the script it's (NOT) hitting now reads:
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $q = new CGI;
print $q->header();
my $trans = $q->param('trans') || q!'trans' is undef!; print <<HTML;
<HTML>
<HEAD>
<TITLE>Jackson Elementary School</TITLE> <BASEFONT SIZE=5>
</HEAD>
<BODY>
$trans
</BODY>
</HTML>
HTML
--
"Because all you of Earth are idiots!"
¯`ˇ.¸¸.ˇ´¯`ˇ-> freemontŠ <-ˇ´¯`ˇ.¸¸.ˇ´¯
- Posted by Brian Wakem on March 10th, 2006
freemont wrote:
Well the syntax is ok and it works for me:-
$ ./tmp76.pl
Content-Type: text/html; charset=ISO-8859-1
<HTML>
<HEAD>
<TITLE>Jackson Elementary School</TITLE> <BASEFONT SIZE=5>
</HEAD>
<BODY>
'trans' is undef
</BODY>
</HTML>
You need to check your web server's error log.
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
- Posted by freemont on March 10th, 2006
On Fri, 10 Mar 2006 20:26:38 +0000, Brian Wakem wrote:
godaddy says that on my shared hosting, I can't access the server's error
log. The guy said that even he can't.
The help guy I just spoke with said that their CGI guy stuck this into my
/cgi directory and ran it, and it confirmed for him that CGI was
functional on my site:
#!/usr/bin/perl
print <<EndBlock01;
Content-type: text/html
<html>
<head>
<title>
INFO.CGI
</title>
</head>
<body bgcolor = "#ffffff">
<center>
<h2>
Display info: what do I know?
</h2>
</center>
<h3>Environment:</h3>
EndBlock01
while(($ekey, $eval) = each(%ENV)){
print "$ekey : $eval<br>\n";
if ($ekey eq 'PATH') {
$path = $eval;
}
}
print <<EndOtherBlock;
<hr>
<h3>Other Interesting Info:</h3>
<tt>
EndOtherBlock
$uname = `uname -a`;
print "Uname info : $uname<br>\n";
$mydir = `ls -ld .`;
print "Working directory : $mydir<br>\n";
$mypath = `pwd`;
print "Path to current directory : $mypath<br>\n";
$myid = `id`;
print "Ids : $myid<br>\n";
$tarfound = $perlfound = $smfound = 0;
@paths = split(/:/, $path);
foreach (@paths) {
if ( -e "$_/tar" ) {
$tarfound = 1;
print "Tar found : $_/tar<br>\n";
}
if ( -e "$_/perl" ) {
$perlfound = 1;
print "Perl found : $_/perl<br>\n";
$perlversion = `$_/perl -v`;
print "Perl version : $perlversion<br>\n";
}
if ( -e "$_/sendmail" ) {
$smfound = 1;
print "Sendmail found : $_/sendmail<br>\n";
}
}
if ($tarfound == 0) {
print "Could be TROUBLE: tar not found on server PATH<br>\n";
}
if ($perlfound == 0) {
print "Could be TROUBLE: perl not found on server PATH<br>\n";
}
if ($smfound == 0) {
print "Could be TROUBLE: sendmail not found on server PATH<br>\n";
}
print <<EndBlock02;
</tt>
</body>
</html>
EndBlock02
They insist that it's a scripting error.
I do have access to a "Web Stats" interface, and under "Directory Report",
I see many requests to directories such as /images, root, /styles, and
/stats, but NONE to /cgi. This suggests to me that the html page isn't
even getting that far.
So this is where I'm at: I have a working script, functional CGI, and a
web page that seems to be passing the correct values. But it appears the
values are going nowhere. I am at a loss. And support at godaddy is not
helping. I can't move forward. :-(
The web page sits in the root directory. The script sits in /cgi. Any
references to that script would be href="cgi/script.cgi", correct? What
the hell's going on here?
Sorry, but this is frustrating. Any more ideas, anyone?
And thanks for your time. :-)
--
"Because all you of Earth are idiots!"
¯`ˇ.¸¸.ˇ´¯`ˇ-> freemontŠ <-ˇ´¯`ˇ.¸¸.ˇ´¯


