Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

can't execute a CGI/perl script

Hi, I made a perl script and saved it as cgi-bin/temp.pl and this is what it contains:

print "Content-Type: text/html\n\n";
print "hello";
exit;

I then made an shtml file and saved it in my home directory as temp.shtml and this is what it contains:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
     <title>Untitled</title>
</head>

<body>

<!--#exec cgi="http://niltz0.tripod.com/cgi-bin/temp.pl"-->

</body>
</html>


but when I try to open the page I get an error processing directive.  Any ideas?  Yes I know the first line of the script is not #!/usr/bin/perl or whatever, but that is because it is not required for tripod.  I am able to use <!--#include virtual = "filename" --> so as far as I know <!-- #exec cgi = "filename" --> should work.
0
niltz
Asked:
niltz
  • 4
  • 3
  • 2
  • +2
2 Solutions
 
makerpCommented:
you probably dont have execute permissions. also the file will need to be set for execute using chmod
0
 
ahoffmannCommented:
1. is your script temp.pl running from command-line?
2. is your web-server configured to allow #exec in SSI?

Please post complete error message.
0
 
amitabhraiCommented:
In many servers the "Exec" option for SSI is turned off due to security reasons. You might want to verufy whether server is allowed to run "EXEC CGI".
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
SteveFersonCommented:
<!--#include virtual="..."--> should be enough to do what you want.

Most webhosts don't allow extended SSI (inculding the "exec" include) because it can allow people to wreak havoc with the server. This is even true of such hosts as UKlinux.net which is primarily for amateur developers and students writing programs etc so I'm sure tripod won't let you do it, as it's a much more commercial offering.
0
 
niltzAuthor Commented:
The file has execute permissions.  If you run the script by entering http://niltz0.tripod.com/cgi-bin/temp.pl it will work, but if you go to http://niltz0.tripod.com/temp.shtml then I get the following error:
[an error occurred while processing this directive]

You can see for yourselves by just going to the links.

If I am unable to use <!--#exec cgi="filename"--> then how do I use <!--#include virtual="filename"--> to get the same results?  When I use it I just get the contents of my script being displayed and not the output that the script would generate.  What I want to end up doing is creating a script to generate random quotes and then call this script from a shtml file.  I don't see any other way of doing it other than using <!--exec cgi="..."-->, but then again I am new to CGI so maybe there is a way around it.
0
 
amitabhraiCommented:
You can try using
<IFRAME SRC="http://niltz0.tripod.com/cgi-bin/temp.pl">
(for IE)
or
<LAYER SRC="http://niltz0.tripod.com/cgi-bin/temp.pl">
( for Netscape)

instead of "EXEC CGI"
0
 
SteveFersonCommented:
using an "include virtual" directive should produce the right result if it's used correctly, unless perhaps it's been disabled by the server owners in which case your best bet is to find a better host.  If you're in the UK try UKLinux.net
0
 
niltzAuthor Commented:
I don't think "include virtual" is disabled because there are sample scripts that tripod gives us to use and the way we execute them is with a "include virtual" statement.

I would rather stay away from IFRAME and LAYER since I want this to work on all browsers and not just IE or Netscape.
0
 
SteveFersonCommented:
I know it says tripod doesn't need them, how about trying to put the shebang line in at the top? Or do tripod not tell you where Perl is on the server?
0
 
niltzAuthor Commented:
Tripod doesn't tell us where Perl is.  I have tried putting #!usr/bin/perl at the top anyway but it doesn't help.

When I try to use "include virtual" does my script need to contain anything special?  Or is what I posted at the top fine?
0
 
ahoffmannCommented:
you have little chance to find the reason if you haveno accessto the web-servers error-log,
Ask the admin to give the detailed error messages, or you just can guessing ..
0
 
SteveFersonCommented:
Try #!usr/local/bin/perl

I really suggest you try a new host, like hypermart.net or virtualave.net - both of whom allow you access to your error logs AND let you know where Perl is. (They also have confirmed support for SSI)
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 4
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now