Jump to content

Recommended Posts

Posted

I am new and am learning about SSI, CGI with Perl...

 

1st)

SSI

I am not able to get the exec command to work with SSI. I have used other codes fine. I am trying to do somthing simple like:

<!--#exec cmd="ls" -->

 

2nd)

CGI/Perl

 

Why is the following needed?

use CGI::Carp qw(fatalsToBrowser);

 

I could not get my CGI/Perl to run without this.

Posted

I'm guessing that SNH has the SSI exec directive disabled, as it is a security risk. However, one can achieve similar results with the include directive. For example, create a CGI script to run the ls command:

#!/bin/sh

 

echo "Content-type: text/html"

echo ""

echo ""

ls

 

Put this directive in your .shtml file:

<!--#include virtual="cgi-bin/script.sh" -->

 

 

As for your second question, use CGI::Carp qw(fatalsToBrowser) is used to send error messages to the web browser for testing and debugging. What exactly happens when you try to run the script without this?

 

Rob

Posted

If I do not include this line my cgi scripts would not run. The browser returned an error. I fumbled around for an hour or two trying everything I could think of... Finally I came across the new file under the file manager. When I created a new file with the Perl script template I saw the needed line...

 

As for the exec command I have been told by the help desk that it is turned off. Thanks for the example code to achieve the same result!

Posted

I'm not sure why your script won't run without including CGI::Carp(fatalsToBrowser). I created a simple test script that ran fine without it.

 

Could you post your code so we can see exactly what's going on?

Posted

Well, it looks like you are right. I removed the line from my .cgi files and they ran fine....

 

I dont know, there might have been a ghost in my machine when I was trying to get it to work before. I am guessing it had somthing to do with the permissions...

 

But anyhow all is well and I am progressing nicely now. So far I am very pleased with the service you provide here!

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...