Internal Server Error

Reply

Join Date: Nov 2006
Posts: 3
Reputation: leathan is an unknown quantity at this point 
Solved Threads: 0
leathan leathan is offline Offline
Newbie Poster

Internal Server Error

 
0
  #1
Nov 9th, 2006
Hai, I was trying to run a CGI cript that proccessed people's information... Well anyway I kept getting the very unhelpful Internal Server Error So I decided to make a stupid script that merely displayed "Works" To the screen. I contacted my webserver (1and1.com) they told me perl scripts could be run anywhere from the server as long as they had a .pl/.cgi extension and were chmoded to 755. 1and1 also said that the path for perl was /usr/bin/perl so the first line of the script would be #!/usr/bin/perl. I made the file:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Works";

I saved the file as display.cgi, I put it on my webserver under /AxE/ directory chmoded to 755 and it still gave me "Internal Server Error" I then just to check made a cgi-bin folder and put it there and still the same error... I'm going crazy and am out of ideas, if anyone could help they would be garanteed a spot as my hero


PS: I also tried saving it as .pl not chmoding and i also tried chmoding while it was in the cgi-bin directory which I was told is not needed. I also tried googling hello world examples incase maybe I had a coding bug... :-\


PSS: I posted this on another forum and basicly recieved no help, well i guess i learned that merely creating a cgi-bin folder does nothing, and i knew this already however I thought that my webserver would see the folder and set it up as a ScriptAllias. another thing that should be noted is i double adn triple checked and on my webserver it states that scripts can be put anywhere as long as they have a .pl or .cgi extension are uploaded under ascii mode and are chmoded to 755. Infact my acnt didn't even come with a cgi-bin folder.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,355
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: Internal Server Error

 
0
  #2
Nov 10th, 2006
Well, yes, seemingly they can run from everywhere, or you wouldn't be getting an internal server error, but rather the contents of the script spilled out onto the browser (or the browser asking you what you wanted to do with ".pl" file).

As to why it is failing, hard to say. I would say to send 1and1 a copy of your simple example and ask them why it might be failing.

Another thing to try, when it is a perl file, they may have something that checks that you are actually running in "Taint" mode (i.e. /usr/bin/perl -T) and when you are not fail your script in some way. I don't know if you have tried this already, but make an attempt at using -T.

Also, do have access to logs anywhere. The logs should have some better explanation as to what went wrong with your script.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Internal Server Error

 
0
  #3
Nov 10th, 2006
how did you put your file onto the server? did you upload it in ASCII mode? binary mode wont work. I had big problems using Windows FTP as it assumes the filetype and doesn't seem to have any options.. try uploading the file using your domains control panel if you have one, or if you have a reasonable FTP client, just make sure it's in ASCII mode whenever you upload a Perl script.
Last edited by MattEvans; Nov 10th, 2006 at 6:03 am.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 3
Reputation: leathan is an unknown quantity at this point 
Solved Threads: 0
leathan leathan is offline Offline
Newbie Poster

Re: Internal Server Error

 
0
  #4
Nov 10th, 2006
MattEvens, I do most of my stuff when i'm on computers that I can't really download stuff with so I just use the Dos Box and yes I typed ascii at the prompt before putting the script on my server. Thanks for the advice though. Masijade useing taint checking is a good idea >.< I feel like a huge idiot for overlooking it... it's quite pssible 1and1 requires it for security, then again it should have told me that when I read about CGI/perl on their FAQ's. I'm going to go try this now..... any other ideas would be great.

EDIT: I'll post back on wether it worked or not in like 10-15mins
Last edited by leathan; Nov 10th, 2006 at 10:12 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 3
Reputation: leathan is an unknown quantity at this point 
Solved Threads: 0
leathan leathan is offline Offline
Newbie Poster

Re: Internal Server Error

 
0
  #5
Nov 10th, 2006
Ugh.. Ok i'm officially going crazy... I tried with -T on and still the same completely unhelpfull error msg!
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 494
Reputation: Puckdropper is an unknown quantity at this point 
Solved Threads: 21
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: Internal Server Error

 
0
  #6
Nov 10th, 2006
Do you have perl locally? Try running your script through that and see if it returns an error.
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Internal Server Error

 
0
  #7
Nov 12th, 2006
i tried uploading your script, from dos, to an apache and an IIS server. it worked fine both times.

what editor did you save your file using? the editor could have put incorrect line terminators, that's quite unlikely though =S

i've attached a file, test.txt. rename it to test.pl, open it to look at it by all means but don't re-save it.

try uploading that, it worked the first time on both servers, i didn't even need to change permissions.

EDIT: by the way, if the Error 500 screen really annoys you (it really annoys me), add this use to any script functioning as a CGI:
  1. use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
but of course, if Perl can't run, Perl can't use CGI::Carp.
Last edited by MattEvans; Nov 12th, 2006 at 1:08 am.
Attached Files
File Type: txt test.txt (69 Bytes, 2 views)
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 262
Reputation: Dukane is an unknown quantity at this point 
Solved Threads: 22
Dukane's Avatar
Dukane Dukane is offline Offline
Posting Whiz in Training

Re: Internal Server Error

 
0
  #8
Dec 9th, 2006
Make sure the directory is also executable?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 4
Reputation: xmassey is an unknown quantity at this point 
Solved Threads: 0
xmassey xmassey is offline Offline
Newbie Poster

Re: Internal Server Error

 
0
  #9
Nov 6th, 2007
Hello,

This problem was posted a long time ago, but I also run my Perl/CGI scripts from a 1and1 web server... The reason your script isn't working is because you must use CGI standard and some of the time, strict. Web based Perl scripting is called CGI, (although it doesn't matter whether you use the extension .pl or .cgi), and if you are using declarations such as "Content-type: text/html\n\n", obviously html is a web based code, therefore comes under CGI. FOR EVERY SINGLE SCRIPT YOU WRITE ALWAYS START WITH #!/usr/bin/perl use strict; use CGI ':standard';. People who said they ran your code and it worked were right, because their system doesnt require to use CGI Standard. To learn more, look for books on CGI, not Perl. (CGI For the World Wide Web)

  1.  
  2. #!/usr/bin/perl
  3. use strict;
  4. use CGI ':standard';
  5. print "Content-type: text/html\n\n";
  6. print "Works";

That is the solution...

Chris
Last edited by xmassey; Nov 6th, 2007 at 3:22 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: Internal Server Error

 
0
  #10
Nov 6th, 2007
Hi Chris,

try this on your 1and1 server:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Works";

it should work. The CGI module does not have to be loaded to run a CGI script.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC