500 Internal Server Error - with a twist

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2005
Posts: 1
Reputation: timd is an unknown quantity at this point 
Solved Threads: 0
timd timd is offline Offline
Newbie Poster

500 Internal Server Error - with a twist

 
0
  #1
Aug 3rd, 2005
I kept getting 500 Internal Server Errors when trying to set up one of my Perl scripts, so I decided to test a simple "Hello World!" script. It produced the same error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

I've uploaded the file in ASCII, I've set the permissions to 755, I've connected to the server with ssh and verified the path to Perl. None of that fixed the problem. The strangest part is when I try to run the script while I've connected with ssh is that it works:

$ ./test.cgi
Content-type:text/html

Hello world! This CGI / PERL script is working properly!
$

Does anyone have any ideas why I can't get even the "Hello World!" script to run on my web site? Thanks for your help.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: 500 Internal Server Error - with a twist

 
0
  #2
Aug 4th, 2005
post the hello world code
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 10
Reputation: trickykid is an unknown quantity at this point 
Solved Threads: 0
trickykid trickykid is offline Offline
Newbie Poster

Re: 500 Internal Server Error - with a twist

 
0
  #3
Aug 24th, 2006
Originally Posted by Comatose View Post
post the hello world code
This wouldn't be a problem with the script since it runs fine from the command but a misconfiguration of apache or whatever webserver you are using.
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: 500 Internal Server Error - with a twist

 
0
  #4
Aug 31st, 2006
my webserver's well wierd, i have a cpanel frontend i can login to plus various ftp clients on my pc; if i upload a perl script and set the permissions correct i get a 500 error, if i overwrite a working perl script (using ActiveState Komodo) i get a 500 error (of course i check the permissions afterwards!) if i upload a file then change the permissions using cpanel, guess what! i get a 500 error.

infact, the only way i can get a perl script up, is to use my cpanel to create a new perl file, then set the permissions, then overwrite the contents of the file; but only in cpanel.

what's with that?! :eek:
Plato forgot the nullahedron..
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: 500 Internal Server Error - with a twist

 
0
  #5
Aug 31st, 2006
make sure you are uploading the file in ASCII (text) format and not binary format.
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: 500 Internal Server Error - with a twist

 
0
  #6
Sep 1st, 2006
Originally Posted by KevinADC View Post
make sure you are uploading the file in ASCII (text) format and not binary format.
Hm; using Windows XP FTP you don't have a choice, and the files always read as ASCII when I view at them. Would I see a visible difference (in the file contents) if it was uploaded in binary mode? Surely there'd only be a problem uploading binary-type files as ASCII?

Komodo's remote save should certainly be ASCII though!

Loading an ftp client other than Windows XP is as much of an inconvenience as opening up cpanel..

It seems arbitrary sometimes; I've had success with XP FTP sometimes, and Komodo remote save sometimes : but the only way at the moment that I can guarantee 500 errors arent a result of my own mistakes is to create the files in cpanel and overwrite the contents...

It took me hours to figure out that that would work. Certainly seems strange!
Last edited by MattEvans; Sep 1st, 2006 at 1:41 am.
Plato forgot the nullahedron..
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: 500 Internal Server Error - with a twist

 
0
  #7
Sep 1st, 2006
I would at least try using an FTP client to eliminate if XP FTP is the problem or not.
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: 500 Internal Server Error - with a twist

 
0
  #8
Sep 8th, 2006
With XP's FTP client, you have a choice. Use "binary" or "ascii" to set the mode. (See also:http://www.uncreativelabs.net/howtos/ftp.htm (Yes this is a plug.))

Also, are you trying to run your "Hello World" script on the web server side in the cgi-bin directory? Once I put the file in cgi-bin and set permissions, it ran fine.

http://puckdroppers.us/cgi-bin/test.pl

--

For the record I'm new to Perl, about furthest I've gotten is declaring my intent to learn it and giving a few reasons why.
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: 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: 500 Internal Server Error - with a twist

 
0
  #9
Sep 8th, 2006
Originally Posted by trickykid View Post
This wouldn't be a problem with the script since it runs fine from the command but a misconfiguration of apache or whatever webserver you are using.

I missed your post somehow so I realize this is a late reply. The problem could very well be the script. If run as a CGI it needs to print an http header before trying to print anything else. This is not a problem from the command line and will work, but will error out with a 500 ISE if initiated as a CGI script from a browser.
Last edited by KevinADC; Sep 8th, 2006 at 3:35 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 30
Reputation: sut is an unknown quantity at this point 
Solved Threads: 1
sut sut is offline Offline
Light Poster

Re: 500 Internal Server Error - with a twist

 
0
  #10
Sep 12th, 2006
After you have created a working copy with cpanel and overwritten it with your code, do
  1. cat -v test.pl
Then rename that file.
  1. mv test.pl goodtest.pl
Then upload so you get the 500 error and do the cat again.
  1. cat -v test.pl
Then diff them.
  1. diff test.pl goodtest.pl
And post all output here.

I think the upload is messing with your output. I'm betting on the DOS EOL is corrupting the
"Content-type: text/html" string into "Content-type: text/html^M"
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