Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to use Korn cgi script with apache
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ryker
Guru
Guru


Joined: 28 May 2003
Posts: 412
Location: Portage, IN

PostPosted: Tue Dec 21, 2004 9:40 pm    Post subject: How to use Korn cgi script with apache Reply with quote

I found a nice little web counter script that I wanted to put on a web page. It is a Korn script and I can't get it to work. I installed ksh and it still didn't work. The cgi-bin script is executable and so is the html page I am calling it from. Can someone help me with this one.
The cgi-bin script called 'hclcount' is:
Code:

#!/bin/ksh

# This script creates a file showing the number
# of times it has been executed.  Useful for
# background counts of html accesses and the like.
# Written by Jay Hennigan (jay@west.net)
# Released to the public domain 1996.

echo
typeset -i counter=1
outfile=../htdocs/$1
if test -s $outfile
then
  read counter < $outfile
  counter=$counter+1
fi
  echo $counter > $outfile

My simple test page called 'hittest.html' is:
Code:

<html>
<head>
<title>Page to test my hit counter</title>
</head>
<b>Total Hits: <!--#include virtual="/var/www/localhost/cgi-bin/hclcount?testpage"--></b>
</html>

I have also tried:
Code:

<!--#include virtual="/cgi-bin/hclcount?testpage"--></b>

and it doesn't work.
I created the testpage file by doing the following in htdocs directory:
Code:

touch testpage
chown apache:apache testpage
chmod 755 testpage

Any help would be appreciated.
_________________
Athlon 64 3200+, 80G WD sata hd + 200G IDE, 1G Geil DDR400, MSI K8T Neo
IntelCore2Duo 2.0Ghz MSI laptop,100G SATA hd, 2G RAM
Back to top
View user's profile Send private message
Crisis
l33t
l33t


Joined: 10 Feb 2003
Posts: 613
Location: Portland, OR

PostPosted: Tue Dec 21, 2004 9:45 pm    Post subject: Reply with quote

Running Korn scripts from an html page just plain sounds like a bad idea to me, but maybe I am off base.

Unless you really need it to be Korn specially, I would recommend looking into PHP or maybe perl.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum