LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-04-2005, 10:45 PM   #1
k1ll3r_x
Member
 
Registered: Sep 2004
Location: Laredo, TX
Distribution: Debian 11
Posts: 164

Rep: Reputation: 30
Apache Server and Hit Counter


Well i was using Apache on linux for quite a while, and it never occured to me, to use a counter, im currently running it on a windows machine, and im wondering, if anyone knows of apache using hit counters, and if anyone knows of one, or anything similar to this, just to keep track of how many people visit the website, id like to know please, i will really appreciate.
- Jerry V.
 
Old 07-05-2005, 01:38 AM   #2
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Most hit counters are pretty plain-vanilla, if you find one that uses PHP and MySQL it doesn't matter what platform they're running on (as long as you have PHP and MySQL of course).

You can even write a quick one in PHP that uses a flat-file and doesn't even need MySQL...
 
Old 07-05-2005, 01:40 AM   #3
k1ll3r_x
Member
 
Registered: Sep 2004
Location: Laredo, TX
Distribution: Debian 11
Posts: 164

Original Poster
Rep: Reputation: 30
how could i do that though? i have some source code thingy, i dont know how to get it going
Code:
#!/usr/bin/perl

# Open the counter file
open(HITS,"counter.txt");
$count=<HITS>;
close(HITS);
# Check if the counter is a valid number
if($count ~! m/[0-9]*/){$count=0}
# Increment the count
$count++;
# Record the count
open(HITS,"+>counter.txt");
print HITS $count;
close(HITS);
# Report the count
print "content-type:text/html\n\nYou are visitor $count";
exit;
 
Old 07-05-2005, 01:50 AM   #4
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
That's a PERL (CGI) script, I'm afraid I'm a PHP kid and don't know much about PERL.

AFAIK you'd have to put a reference to that script in your page somewhere and put the script itself in the CGI-BIN directory of Apache and make it chmod +x.

Don't take my word on it though, get a PERL guy to tell you.
 
Old 07-05-2005, 07:58 AM   #5
RanDrake10
Member
 
Registered: Oct 2004
Location: Florida
Distribution: Debian
Posts: 319

Rep: Reputation: 30
Try this link
http://www.muquit.com/muquit/software/Count/Count.html
This counter will work in Linux & Windows.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi, I've got an apache server which keeps crashing when I hit it with a web browser. humbletech99 Linux - Networking 6 11-30-2005 04:06 AM
Page counter on apache server dranobob Linux - Newbie 1 08-29-2005 07:05 PM
hit counter dragon Programming 6 07-04-2005 11:06 PM
Counter-Strike Server HazzGiG Linux - Games 3 04-02-2004 03:13 PM
php hit counter problems ukch Programming 9 12-03-2003 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration