Jump to content

[Solved] Perl / Ruby Cgi - 500 Internal Server Error


dagger

Recommended Posts

Hi everyone!

 

i have a Problem with a Perl/Ruby CGI Script - 500 Internal Server Error.

 

user: dagger

address: http://dagger.heliohost.org

Server: Johnny

 

From the very beginning Perl was not worked:

 

http://dagger.helioh...cgi-bin/test.pl

 

#!/usr/bin/perl
BEGIN {
my $b__dir = (-d '/home/dagger/perl'?'/home/dagger/perl':(/>/> getpwuid($>) )[7].'/perl');
unshift @INC,$b__dir.'5/lib/perl5',$b__dir.'5/lib/perl5/x86_64-linux',map { $b__dir . $_ } @INC;
}

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>A Simple Perl CGI</title>
</head>
<body>
<h1>A Simple Perl CGI</h1>
<p>$theTime</p>
</body>
HTML

 

Ruby was for beginning worked, but now the same problem - 500 Internal Server Error

 

http://dagger.helioh...gi-bin/test.cgi

 

#!/usr/local/bin/ruby -w
require 'cgi'
cgi = CGI.new
puts cgi.header
puts "<html><body>This is a test</body></html>"

 

http://dagger.helioh...in/test_ruby.rb

 

#!/usr/bin/ruby
puts "Content-type: text/html"
puts
puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
puts "<!DOCTYPE html>"
puts "<html>"
puts "<head>"
puts "<title>Ruby CGI test</title>"
puts "</head>"
puts "<body>"
puts "<p>Hello, world!</p>"
puts "<br>
puts "Ruby is amazing! :)/>/>"
puts "</body>"
puts "</html>"

 

My question is, what happened with Perl and Ruby? :blink:

 

Python and Free Pascal CGI working fine

 

Thanks in advance!

 

P.S.

 

Sorry, for my pure English

Link to comment
Share on other sites

http://yashrs.heliohost.org/cgi-bin/test_ruby.rb

 

#!/usr/bin/ruby
puts "Content-type: text/html"
puts
puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
puts "<!DOCTYPE html>"
puts "<html>"
puts "<head>"
puts "<title>Ruby CGI test</title>"
puts "</head>"
puts "<body>"
puts "<p>Hello, world!</p>"
puts "<br>"
puts "Ruby is amazing! :)/>/>/>/>"
puts "</body>"
puts "</html>"

 

 

Perl:-

You can always put this on the top of the perl file to get the error of your perl code:-

use CGI::Carp qw( fatalsToBrowser );

 

http://yashrs.heliohost.org/cgi-bin/test.pl

 

#!/usr/bin/perl
use CGI::Carp qw( fatalsToBrowser );
BEGIN {
   my $b__dir = (-d '/home/yashrs1/perl'?'/home/yashrs1/perl' getpwuid($>) )[7].'/perl');
   unshift @INC,$b__dir.'5/lib/perl5',$b__dir.'5/lib/perl5/x86_64-linux',map { $b__dir . $_ } @INC;
}
print "Content-type: text/html\n\n";
print "<html><head><title>Test Page</title></head><body>";
print "Hello World!";

 

Link to comment
Share on other sites

http://yashrs.heliohost.org/cgi-bin/test_ruby.rb

#!/usr/bin/ruby puts "Content-type: text/html" puts puts "" puts "" puts "" puts "" puts "" puts "" puts "" puts "
Hello, world!
" puts "
" puts "Ruby is amazing! :)/>/>/>/>/>" puts "" puts ""

Perl:- You can always put this on the top of the perl file to get the error of your perl code:-

use CGI::Carp qw( fatalsToBrowser );

http://yashrs.heliohost.org/cgi-bin/test.pl

#!/usr/bin/perl use CGI::Carp qw( fatalsToBrowser ); BEGIN { my $b__dir = (-d '/home/yashrs1/perl'?'/home/yashrs1/perl':(/> getpwuid($>) )[7].'/perl'); unshift @INC,$b__dir.'5/lib/perl5',$b__dir.'5/lib/perl5/x86_64-linux',map { $b__dir . $_ } @INC; } print "Content-type: text/html\n\n"; print ""; print "Hello World!";

 

Thanks, but to no avail.

As I mentioned, Ruby script worked before. But for some reason stopped working right now.

Perl did not work from the start and the line

use CGI::Carp qw( fatalsToBrowser );

in the script did not change anything.

 

I get this error here and I can not understand what is wrong.

 

Internal Server Error

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

Please contact the server administrator, webmaster@dagger.heliohost.org 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 dagger.heliohost.org Port 80

For example, okay, Perl did not work from the very beginning. But Ruby was working, why has stopped working now?

 

With the best regards

Link to comment
Share on other sites

This support request is being escalated to our root admin. Just a question, are you setting the file permissions to 755 ?

 

Thanks! :)

Aha, I also tried 775 to - the Result is as i was up wrote

 

With the best regards

Link to comment
Share on other sites

test_ruby.rb is giving a 500 error because you're missing the closing double quote on line 13:

 1 #!/usr/bin/ruby
 2
 3 puts "Content-type: text/html"
 4 puts
 5 puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
 6 puts "<!DOCTYPE html>"
 7 puts "<html>"
 8 puts "<head>"
 9 puts "<title>Ruby CGI test</title>"
10 puts "</head>"
11 puts "<body>"
12 puts "<p>Hello, world!</p>"
13 puts "<br>
14 puts "Ruby is amazing! "
15 puts "</body>"
16 puts "</html>"

 

test.cgi is giving a 500 error because your shebang line is wrong. There is no

# ls -la /usr/local/bin/ruby
/bin/ls: /usr/local/bin/ruby: No such file or directory

Use the shebang as your other working ruby script and you should be fine on that one too.

 

test.pl isn't giving a 500 error for me so just fix the error that is reported.

Link to comment
Share on other sites

Ohh, thank you!

Now run the scripts properly - thank you!

What I do not understand I've tried everything and Perl scripts has always spit out 500 errors. But now is running and the recommendation of Yashrs works now, but previously was not, no matter what I did.

 

But no matter :) The main thing is that now runs everything :)

 

regards

Link to comment
Share on other sites

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