Jump to content

Recommended Posts

Posted

Am stuck trung to diagnose what is wrong with my perl CGI. A simpel port from a previous host, so I try say a simple Perl script that prints a list of variables:

 

http://bernd.wechner...bin/printenv.pl

 

and the error I receive is:

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@bernd.wechner.info and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/0.9.8e-fips-rhel5 mod_mono/2.6.3 mod_jk/1.2.35 FrontPage/5.0.2.2635 mod_bwlimited/1.4 mod_auth_passthrough/2.1 mod_wsgi/3.4 Python/2.7.4 Server at bernd.wechner.info Port 80

 

And yet in my error log I see only a failed access attempt to:

 

[Tue May 12 14:30:16 2015] [error] [client 122.151.20.175] File does not exist: /home/bwechner/public_html/bernd/500.shtml

 

which makes sense as Ithe reported error says as much.

 

Now the script has mode 0755 as needed and it resides in the cgi-bin fold which laso has 0755 mode.

 

The access log correctly shows:

 

122.151.20.175 - - [12/May/2015:14:30:16 -0700] "GET /cgi-bin/printenv.pl HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"

 

And the favicon displays on my browser tab.

 

Is there a way to further diagnose why a very simple perl CGI would throw a 500 error? Here's all it contains:

 

#!/usr/bin/perl

 

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

 

foreach $key (keys %ENV) {

print "<li>$key: $ENV{$key}";

}

 

Any help would be deeply appreciated.
  • 2 weeks later...
Posted

Thanks Byron! Will try. As soon as I can log back in. Something seems up with my account or with Johnny, Looking into it now.

  • 5 weeks later...
Posted
Define your first line of code (shebang line) like this
#!/usr/bin/perl -w

 

Finally got to log on again added -w to the first line and voila it works. Thanks enormously Byron.

 

The irony is that -w only turns on warning reports and yet adding it seems to stop the script from bailing as well, i.e. it seems it bails on warnings without it causing the error. Must check the warnings, perhaps in the log file, when I get around to it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...