?
Solved

SSI in html page fail to execute (counter script , etc)

Posted on 2003-02-26
5
Medium Priority
?
267 Views
Last Modified: 2013-12-27
I have an html page calling for execution of a counter script like so:
<!--#exec cgi="../cgi-bin/counter.cgi"-->
The script works when executed directly in the browser as counter.cgi, but not when called from the page.

I've configured the Netscape Enterprise 4.1 SP12 web server on my Solaris 8 v 2/02 Sparc20 to activate server-parsed html with the exec tag and to parse all html files from the doc root on down.

There are 3 files involved: a counter data file which increments when the script is executed, the script itself and the html page which calls it.  The permissions are 745 for the web page, 755 for the cgi, and 666 for the data file.

The error I get inside the web page is:[an error occurred while processing this directive]

I've tried other SSI, like including a random quotes script, or a date, these all work on another server running Apache but not with Netscape.  I can't switch to Apache right now, I'm supposed to stick with our baseline and find something that works.  I'd really like to know why this won't work, and the fix for it.  

Here's the cgi script:
#!/usr/bin/perl -wT
use CGI;
#use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use Fcntl qw(:flock);

$countfile = "counter";

$cgi = CGI->new;
print $cgi->header;

if (-e $countfile) {
     open(OUT, $countfile) or &dienice ("Couldn't open file: $!");
     flock(OUT, LOCK_EX);
     seek(OUT, 0,0);   #go to the beginning of the file
     $count = <OUT>;   #read one line
     close(OUT);
     $count = $count +1  #increment the counter
     }
     else {
     $count =  1;
     }

open(OUT,">$countfile") or &dienice("Couldn't open file: $!");
     flock(OUT, LOCK_EX);
     print OUT "$count\n";
     close(OUT);

     print "You are visitor number $count.";

sub dienice {
     my($errmsg) =  @_;
     print $errmsg;
     exit;
     }

What's incredibly frustrating (other than this should be a lot more simple than I have found it to be) is that I can't even diagnose the problem, since the script runs from the command line and the web server error logs show nothing.

Thanks,
Christine



0
Comment
Question by:klukac
[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
  • 3
  • 2
5 Comments
 

Author Comment

by:klukac
ID: 8032032
I'm not sure where this question belongs, Applications or Programming are probably more appropriate than Solaris, however when I tried to edit the question, changing the category didn't show up as an option.  
0
 

Expert Comment

by:killerwhack
ID: 8037390
This could be several things.  The first thing that jumps at me is the relative path in the exec tag.  If I recall correctly that relative file paths are not allowed (for security reasons)

0
 

Accepted Solution

by:
killerwhack earned 400 total points
ID: 8039277
Another thing it could be: the syntax of the exec tag-

<!--#exec cmd="/main/script.cgi" -->

0
 

Expert Comment

by:killerwhack
ID: 8039295
look in the errors log file to, perhaps, see more information as to why the ssi failed.
0
 

Author Comment

by:klukac
ID: 8041766
This has been bugging me for a long time, thanks very much!
I tried the path from root, which didn't work, but finally got a response from the web server.  The error logs showed root twice in the path.  So getting rid of the .. in the relative path was the key.  
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

764 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