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