Complex cgi script works, but test.cgi doesn't

349 views Asked by At

I have two cgi files in the same cgi-bin folder. One complex 300hundread lines script works fine, but when it comes to this simple cgi-script:

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "<html><head>";
print "<title>CGI Test</title>";
print "</head>";
print "<body><h1>I just wrote a web page using Perl!</h1>";
print "</body></html>";

the web page will return an 500 Internal Server Error...

Why?:(

EDIT: Ok, the problem was solved on one server, the cgi works fine. But...
Now I'm trying to make the cgi-scripts work on another server and it seems that no matter what I do I keep getting the "Internal server error" message and nothing in the error log. Any suggestions?

4

There are 4 answers

0
XCS On BEST ANSWER

I've talked to the hosting firm and they said that they don't offer any "CGI/PERL" sript hosting...

So , problem solved... (kind of).

LESSON: Always read carefully before buying a hosting package :D

0
Ted Hopp On

Two possibilities come to mind:

  • your simple script does not have execute privilege set
  • test.cgi is a special name that is redirected elsewhere by the server configuration

Can you run test.cgi from the command line?

1
webdevbyjoss On

Check Web-server logs for details.

In most cases its a permissions issues, not only the permission to execute this script but for example some web-servers by default refuse to execute scripts with 777 or any other writable permissions for security reasons.

Try to set 644 permissions for that file.

1
Ted Hopp On

Regarding your follow-on question: what kind of server is the other server? Also, is the problem a specific script or all scripts? Can you use any scripts in your cgi-bin? If not, perhaps your virtual host is not configured properly, or perhaps perl is installed somewhere else.