1

I am getting the internal server error when run the perl script.I put the file into the cgi-bin folder and set the permission 755. please let me know the How can I resolve this?

There are two files in cgi-bin folder.One is perldigger.cgi. It is working fine its url is http://mts.marketsignalsoftware.com/cgi-bin/perldigger.cgi and the 2nd is test.cgi. It is giving the internal error. I wrote the simple code into it and url is http://mts.marketsignalsoftware.com/cgi-bin/test.cgi.

 #!/usr/bin/perl -w
 # Program to do the obvious
 print 'Hello world.';      
 # Print a message 

Thanks

Rohit Sharma
  • 95
  • 2
  • 10
  • check the error log. If you aren't doing that then you aren't doing your job and anything else is just guessing. – mpeters Jan 10 '12 at 19:54

1 Answers1

8

Check your error logs and you will see a message about missing headers, maybe something like Premature end of script headers .... The first output of a CGI script should always be a content type header.

Try

#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print 'Hello world.';

Obligatory trouble shooting link for the next problem you have:

How can I troubleshoot my Perl CGI script?

Community
  • 1
  • 1
mob
  • 117,087
  • 18
  • 149
  • 283
  • showing the following warning in the error log. [Tue Jan 10 13:23:54 2012] [error] [client 122.173.44.138] (13)Permission denied: exec of '/mnt/stor10-wc2-dfw1/577993/mts.marketsignalsoftware.com/web/cgi-bin/test.cgi' failed [Tue Jan 10 13:23:54 2012] [error] [client 122.173.44.138] Premature end of script headers: test.cgiwing the following warning in error log. – Rohit Sharma Jan 10 '12 at 19:32
  • @Rohit Sharma - see [the link](http://stackoverflow.com/questions/2165022/). There are 29 other things you can try. – mob Jan 10 '12 at 19:41
  • Permission denied -> Make sure `/mnt/stor10-wc2-dfw1/577993/mts.marketsignalsoftware.com/web/cgi-bin/test.cgi` is reachable and executable by the user as which the web server executes. That means each parent directory (`.../cgi-bin`, `.../web`, etc) must also be reachable by the user as which the web server executes. – ikegami Jan 10 '12 at 21:19