?
Solved

can't execute a CGI/perl script

Posted on 2003-02-20
14
Medium Priority
?
374 Views
Last Modified: 2013-12-25
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
Comment
Question by:niltz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
14 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 7992423
you probably dont have execute permissions. also the file will need to be set for execute using chmod
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7993274
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
 

Expert Comment

by:amitabhrai
ID: 7994045
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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 

Expert Comment

by:SteveFerson
ID: 7994209
<!--#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
 

Author Comment

by:niltz
ID: 7994861
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
 

Expert Comment

by:amitabhrai
ID: 7995647
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
 

Expert Comment

by:SteveFerson
ID: 7996100
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
 

Author Comment

by:niltz
ID: 7996306
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
 

Expert Comment

by:SteveFerson
ID: 7998432
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
 

Author Comment

by:niltz
ID: 7999566
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
 
LVL 51

Accepted Solution

by:
ahoffmann earned 152 total points
ID: 8004133
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
 

Assisted Solution

by:SteveFerson
SteveFerson earned 148 total points
ID: 8032721
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question