Jump to content

PERL\CGI issues + Error 500 + Module Path


Anghel132

Recommended Posts

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)

 

Link to comment
Share on other sites

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

 

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...