943,867 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Unsolved
  • Views: 10439
  • Perl RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 3rd, 2005
0

500 Internal Server Error - with a twist

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
timd is offline Offline
1 posts
since Aug 2005
Aug 4th, 2005
0

Re: 500 Internal Server Error - with a twist

post the hello world code
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Aug 24th, 2006
0

Re: 500 Internal Server Error - with a twist

Click to Expand / Collapse  Quote originally posted by Comatose ...
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
trickykid is offline Offline
10 posts
since Aug 2006
Aug 31st, 2006
0

Re: 500 Internal Server Error - with a twist

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:
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Aug 31st, 2006
0

Re: 500 Internal Server Error - with a twist

make sure you are uploading the file in ASCII (text) format and not binary format.
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Sep 1st, 2006
0

Re: 500 Internal Server Error - with a twist

Click to Expand / Collapse  Quote originally posted by KevinADC ...
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.
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Sep 1st, 2006
0

Re: 500 Internal Server Error - with a twist

I would at least try using an FTP client to eliminate if XP FTP is the problem or not.
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Sep 8th, 2006
0

Re: 500 Internal Server Error - with a twist

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.
Reputation Points: 23
Solved Threads: 23
Posting Pro in Training
Puckdropper is offline Offline
494 posts
since Jul 2004
Sep 8th, 2006
0

Re: 500 Internal Server Error - with a twist

Click to Expand / Collapse  Quote originally posted by trickykid ...
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.
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Sep 12th, 2006
0

Re: 500 Internal Server Error - with a twist

After you have created a working copy with cpanel and overwritten it with your code, do
Perl Syntax (Toggle Plain Text)
  1. cat -v test.pl
Then rename that file.
Perl Syntax (Toggle Plain Text)
  1. mv test.pl goodtest.pl
Then upload so you get the 500 error and do the cat again.
Perl Syntax (Toggle Plain Text)
  1. cat -v test.pl
Then diff them.
Perl Syntax (Toggle Plain Text)
  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"
sut
Reputation Points: 20
Solved Threads: 1
Light Poster
sut is offline Offline
30 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: Lightning Talk Topic Ideas
Next Thread in Perl Forum Timeline: perl mechanize $mech->save_content($filename) problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC