Jump to content

[Answered] Newbie: Problem With Running A Sample Cgi With Perl


Recommended Posts

Hi all.

I've recently got a free account from Heliosoft. Now, i'm unable to run even a simple cgi.

Is cgi active by default?

I've put a simple demo.cgi in cgi-bin with following code:



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

print <<HTML;



<title>A Simple Perl CGI</title>



<h1>A Simple Perl CGI</h1>

<p>Hello World</p>





Then, i've changed file permission to 755 (even 777) but i get following error all times:

Internal Server Error


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

Please contact the server administrator, webmaster@gistech.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.


Any idea of what's wrong here?


Thanks in advance.

Link to comment
Share on other sites

Is cgi active by default?



Any idea of what's wrong here?


Nothing's wrong, as ExtremeGaming pointed out 500 errors are often caused by simple stuff like cPanel or phpMyAdmin being open, has to do with process limits on user accounts. Or when the server's got an extremely heavy load it'll spit 500 errors for most sites.

  • Like 1
Link to comment
Share on other sites

Cgi can be really picky about permissions and syntax, and when it isn't exactly perfectly right it throws the very unhelpful 500 error.


Step one on troubleshooting is to make sure your cgi-bin directory and cgi file both have 755 permissions.


Step two is to make sure you're using the right shebang, which according to your code above looks right to me.


Step three is to make sure you set the correct content type.

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

Is what I use for perl cgi and it works on Heliohost. There may be other slight variations that work too.


Let us know if that doesn't fix the problem.

  • Like 1
Link to comment
Share on other sites

Thanks a world, guys for your comments. Sorry for a bit latency (i thought it may take more time to get a response here. )

Anyway, I haven't opened phpMyAdmin yet.

I tried running cgi with closed cPanel but no help.

I checked permissions and they were both 755.

finally, I tried replacing second line with the line suggested by Support Admin but again no help.


So, problem is still unresolved for me.

Am i right with address, i.e. http://gistech.heliohost.org/cgi-bin/demo1.cgi



Link to comment
Share on other sites

Alright, the next thing I would check would be the encoding on the file. Make sure it's not some crazy dos format with ^M's everywhere, or any other weird line endings. Like I said above cgi can be really picky about syntax, and line endings is just another tough to troubleshoot part of it.

  • Like 1
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.

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