Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

is it the host or is it me?

 
   Web Hosting Problem Solving Community! (Home) -> Webmaster RSS
Next:  mod_ssl not compiling (but no errors on configure..  
Author Message
freemont

External


Since: Jan 31, 2006
Posts: 61



(Msg. 1) Posted: Fri Mar 10, 2006 1:33 pm
Post subject: is it the host or is it me?
Archived from groups: alt>www>webmaster (more info?)

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Š <-ˇ´¯`ˇ.¸¸.ˇ´¯

 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
arccos

External


Since: Jul 08, 2005
Posts: 17



(Msg. 2) Posted: Fri Mar 10, 2006 1:33 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

freemont wrote:
> 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.
>

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. Smile

-Arccos

 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
SmakDaddy

External


Since: Mar 05, 2006
Posts: 23



(Msg. 3) Posted: Fri Mar 10, 2006 1:33 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"freemont" <yabba DeleteThis @dabba.doo> wrote in message
news:pan.2006.03.10.18.33.15.699050@dabba.doo...
> 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.
>

FTP in and CHMOD the script to 755

Still a problem?
Send the url.
 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
freemont

External


Since: Jan 31, 2006
Posts: 61



(Msg. 4) Posted: Fri Mar 10, 2006 3:07 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 10 Mar 2006 19:08:09 +0000, Brian Wakem wrote:

> 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.

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Š <-ˇ´¯`ˇ.¸¸.ˇ´¯
 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
freemont

External


Since: Jan 31, 2006
Posts: 61



(Msg. 5) Posted: Fri Mar 10, 2006 3:08 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 10 Mar 2006 19:33:43 +0000, Gordon Hudson wrote:

>
> "freemont" <yabba.TakeThisOut@dabba.doo> wrote in message
> news:pan.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.

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Š <-ˇ´¯`ˇ.¸¸.ˇ´¯
 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
freemont

External


Since: Jan 31, 2006
Posts: 61



(Msg. 6) Posted: Fri Mar 10, 2006 4:57 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 10 Mar 2006 20:26:38 +0000, Brian Wakem wrote:

> You need to check your web server's error log.

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. Sad

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. Smile

--
"Because all you of Earth are idiots!"
¯`ˇ.¸¸.ˇ´¯`ˇ-> freemontŠ <-ˇ´¯`ˇ.¸¸.ˇ´¯
 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
Mitja Trampus

External


Since: Oct 04, 2005
Posts: 4



(Msg. 7) Posted: Fri Mar 10, 2006 6:55 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

freemont wrote:
> 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.
> ...
> This is the simplest example I could find. All it produces from godaddy
> is:

For starters, it is generally wiser to try something even simpler, e.g.
#!/usr/bin/perl
print "Content-type:text/plain\n\nHello World!";

But I doubt this is the problem.

> "Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request." And so on. Nothing helpful.

One nasty trick: make sure your shebang line doesn't end in a DOS newline, because
otherwise the server (presumably running linux) will be looking for /usr/bin/perl\x0d.
 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
Paul Ding

External


Since: Nov 29, 2005
Posts: 235



(Msg. 8) Posted: Fri Mar 10, 2006 8:55 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Fri, 10 Mar 2006 13:33:16 -0500, freemont <yabba.RemoveThis@dabba.doo> posted
something that included:

>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.

"There's More Than One Way To Do It" - Larry Wall.
Disregard any instructions to rewrite your script. I stuck it on my
server, and it executes just fine. (I *did* change the HTML page to
refer to cgi-bin rather then cgi as the binaries directory, but that
was sheer laziness on my part.)

When you are trying to figure out the problem with a script, the
quickest and easiest way to solve the problems is to SSH in, and run
it from the command line. PERL has pretty good diagnostics, if you
will but use them. Some people ask Perl to carp to the browser, but
that REALLY confuses users if the script fails down the road for one
reason or another. They think they've broken your site somehow, and
they NEVER return.

The biggest problems that new PERL scripters encounter are
1. They upload the script in binary mode. That means the first line
of the script ends in CRLF instead of the LF that Unix/Linux wants,
and the shell thinks the extra CR character is part of the first line
to be executed. (I use a text editor that lets me edit unix files as
unix files under Windows, so I can always FTP in binary. Since CGI
files can be either text scripts OR compiled binaries, FTP programs
cannot handle them automatically, correctly.
2. You need the proper permissions. Most servers execute your
scripts as if YOU were the user, which means you can use 755
permissions. Most of these servers also refuse to execute scripts with
777 permissions for security reasons. If the server is configured to
run your scripts with NOBODY as the user, you need 777 permissions.
(Hint: if you're on a shared hosting server set up this way, find
another server, and don't wait until tomorrow to do it.)
3. A lot of people have trouble with the path to PERL, but you seem
to know what yours is. (I set up my servers so that EITHER of the
popular two locations will work just fine.)
4. A fourth problem is using a module that isn't installed on the
server. That doesn't affect you in this script, though.

You really want to download Putty, though, so you can SSH in and
execute the script from the command line. Trying to debug PERL any
other way is no fun at all.














--
AmishHosting.com
 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
freemont

External


Since: Jan 31, 2006
Posts: 61



(Msg. 9) Posted: Sat Mar 11, 2006 1:54 pm
Post subject: Re: is it the host or is it me? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sat, 11 Mar 2006 00:48:56 +0000, Paul Ding wrote:

> The biggest problems that new PERL scripters encounter are
> 1. They upload the script in binary mode.

"Well I'll be god damned." I just said that out loud. This was the problem.

Thank you, Paul. Thanks to all others who helped also. Lotsa helpful info
in this short thread.

--
"Because all you of Earth are idiots!"
¯`ˇ.¸¸.ˇ´¯`ˇ-> freemontŠ <-ˇ´¯`ˇ.¸¸.ˇ´¯
 >> Stay informed about: is it the host or is it me? 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]