Jump to content

PERL\CGI issues + Error 500 + Module Path


Recommended Posts

Posted

Hi there,

 

I've recently setup my hosting service and am wanting to try to use a perl/cgi chat site. Now I was having problems with the chatsite so I attempted to diagnose the issues I was having (mostly Internal Server Error 500) by starting at the beginning. I copied this test script from the net (very basic as I am not too familar with perl)

 

#!/home/[username]/perl
print "Hello, World!\n";

 

where [username] is my username - anghel. (This has been taken from the perl page in CPanel, it was formerlly /usr/bin/perl and not /home/[username]perl.

 

Running that script (with 755 permissions) still brings up I.S.E. 500 errors, both if it is in the native cgi bin file of the chat script (located in root/airuza/bin) as well as when it is in the cgi-bin folder.

 

My questions are these:

 

1) Am I doing something wrong with the way the script is coded or located, am I missing something?

2) Are there any specific requirements that I have missed to get perl/cgi scripts going, if so what are they? (i.e., must be located somewhere, must have specific modules installed etc)

 

Posted

First make sure you are writing your cgi scripts inside your cgi-bin unless you have your .htaccess set up for other folders. And you have your first line wrong and you forgot your html header. It should look like this:

 

#!/usr/bin/perl -w
print "Content-type: text/html\n\n"; 
print "Hello, world!\n";

 

Here's a better way to write it:

 

#!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
print header; 
print "Hello, world!\n";

 

Here's a basic tutorial that will help you understand:

 

http://www.cgi101.com/learn/

 

 

Cheers,

Byron

 

 

 

 

  • 2 weeks later...
Posted

You're a legend mate!

 

That worked very well.

 

However, you mentioned the .htaccess and allowing cgi to be executed in other folders. -> Is this allowed at heliohost? If so how is it done? I've got a usable chat script that I want to get working, however it was coded by third party and freelance to boot so documentation is minimal if there is any at all.

Posted

Are you familiar with .htaccess? It's just a text file with the complete name .htaccess with no extension and don't forget the (.) dot.

 

If you want to execute cgi in all folders than add this little piece of code in the .htaccess file of your root directory:

 

Options +ExecCGI

 

Or you could just make a seperate .htaccess file for the folder that you want to execute cgi in and add that same piece of code and your all set to go. :)

 

 

 

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...