Can't get dumb webcounter working

J

J. W. McCall

Sorry if this is OT, but here's my question:

I wrote a simple python script to increment a counter in a text file,
and I wanted this script to be accessed whenever an HTML file is
accessed. The HTML files and python script are on a shell account on
UNIX a machine that has support for CGI, Python, etc. I unfortunately
don't know much about CGI, since I assume this is what I need to get
this to work. All I want to do is to get script to be called when the
web site is accessed and hopefully insert some output (a number) into
the HTML.

Any advice, specific instructions, pointers to helpful web resources, or
recommendations to better newsgroups, if this is too OT here, would be
greatly appreciated.

Thanks,

J. W. McCall
 
T

Tyler Eaves

Sorry if this is OT, but here's my question:

I wrote a simple python script to increment a counter in a text file,
and I wanted this script to be accessed whenever an HTML file is
accessed. The HTML files and python script are on a shell account on
UNIX a machine that has support for CGI, Python, etc. I unfortunately
don't know much about CGI, since I assume this is what I need to get
this to work. All I want to do is to get script to be called when the
web site is accessed and hopefully insert some output (a number) into
the HTML.

Any advice, specific instructions, pointers to helpful web resources, or
recommendations to better newsgroups, if this is too OT here, would be
greatly appreciated.

Thanks,

J. W. McCall

Server side includes?
 
B

Barry Sprajc

Tyler's correct.

You'll want to check with those hosting your web site, they usually have
particular directories in your home directory where you'll put your scripts,
etc...

Then, you just need to put the correct HTML code in your document.

/barry sprajc
 
J

J. W. McCall

Barry said:
Tyler's correct.

You'll want to check with those hosting your web site, they usually have
particular directories in your home directory where you'll put your scripts,
etc...

Then, you just need to put the correct HTML code in your document.

From the FAQs and help at my shell account (freeshell.org) it says I
don't need a "cgi-bin" directory or anything like that; I can run
scripts from anywhere.

As far as the correct HTML code...sorry if this is a dumb question, but
what exactly would that HTML code be? I saw something about "<!--
exec"command here" -->" but that didn't seem to work. I've never called
a script from an HTML document. I guess that's what I'm trying to
figure out.

Thanks,

J. W. McCall
 
B

Brian Victor

J. W. McCall said:
As far as the correct HTML code...sorry if this is a dumb question, but
what exactly would that HTML code be? I saw something about "<!--
exec"command here" -->" but that didn't seem to work. I've never called
a script from an HTML document. I guess that's what I'm trying to
figure out.

You're close, but you're missing a few characters:
http://httpd.apache.org/docs-2.0/mod/mod_include.html#element.exec

<!--#exec cgi="yourscript.py"-->

Or similarly the "include virtual" alternative mentioned at the link
above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top