Jump to content

Recommended Posts

Posted

While trying to run this basic Perl CGI script I get a 500 Internal Server Error:

 

#!/usr/bin/perl

use warnings;
use strict;

print "Content-type: text/html\n\n";
print 1;

 

The error log in cpanel doesn't report anything so I'm kind of lost for ideas. The shebang line is in there and it's been changed to 755 permissions. It also doesn't work in my cgi bin. The script location is http://john.heliohost.org/cgiscript.pl

 

Am I missing something? Any help is appreciated.

 

Thanks and regards,

John

Posted

Your file was written in Windows, and as such has carriage returns along with newlines. That messed up the CGI parser. Check now.

Posted

Still 500 errors.

 

I'm not sure how that would mess up the CGI parser though. I've run Perl CGI scripts on an Apache server that I built on CentOS before and wrote all my scripts in Notepad++ then uploaded just as I'm doing now via FTP, and had no problems. I'm surprised nobody has encountered this yet? Either you don't have a lot of CGI users or every CGI user runs Linux?

 

Thanks for the help though!

John

Posted

Not necessarily. One super-easy thing to do would be to just use a text editor that doesn't add the carriage return. Another option is to use whatever text editor, but then use the UNIX utility "dos2unix" to convert the carriage returns. You can get this on Windows with cygwin. Alternately, you could write your own script to do this - it shouldn't be too hard. There might even be something online.

Guest
This topic is now closed to further replies.
×
×
  • Create New...