0% found this document useful (0 votes)
17 views3 pages

statistics - Call Visitors web stat program from PHP - Stack Overflow

Uploaded by

s86022168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

statistics - Call Visitors web stat program from PHP - Stack Overflow

Uploaded by

s86022168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Call Visitors web stat program from PHP

FlySwatFlySwat 175k7575 gold badges248248 silver badges314314 bronze badges

I've been looking into different web statistics programs for my site, and one promising one is
Visitors. Unfortunately, it's a C program and I don't know how to call it from the web server. I've
tried using PHP's shell_exec, but my web host (NFSN) has PHP's safe mode on and it's giving me
an error message.

Is there a way to execute the program within safe mode? If not, can it work with CGI? If so, how?
(I've never used CGI before)

asked Sep 7, 2008 at 15:30

Kyle CroninKyle Cronin

78.9k45 gold badges151 silver badges167 bronze badges

Visitors looks like a log analyzer and report generator. Its probably best setup as a chron job to
create static HTML pages once a day or so.

If you don't have shell access to your hosting account, or some sort of control panel that lets you
setup up chron jobs, you'll be out of luck.

answered Sep 7, 2008 at 15:34

Is there any reason not to just use Google Analytics? It's free, and you don't have to write it yourself.
I use it, and it gives you a lot of information.

Sorry, I know it's not a "programming" answer ;)

answered Sep 7, 2008 at 16:25

Sam McAfeeSam McAfee

10.1k16 gold badges62 silver badges65 bronze badges

1
I second the answer of Jonathan: this is a log analyzer, meaning that you must feed it as input the
logfile of the webserver and it generates a summarization of it. Given that you are on a shared host,
it is improbable that you can access to that file, and even if you would access it, it is probable that it
contains then entries for all the websites hosted on the given machine (setting up separate logging
for each VirtualHost is certainly possible with Apache, but I don't know if it is a common practice).

One possible workaround would be for you to write out a logfile from your pages. However this is
rather difficult and can have a severe performance impact (you have to serialize the writes to the
logfile for one, if you don't want to get garbage from time to time). All in all, I would suggest going
with an online analytics service, like Google Analytics.

answered Sep 7, 2008 at 16:30

Grey PantherGrey Panther

13.1k7 gold badges49 silver badges67 bronze badges

As fortune would have it I do have access to the log file for my site. I've been able to
generate the HTML page on the server manually - I've just been looking for a way to get
it to happen automatically. All I need is to execute a shell command and get the output
to display as the page.

Sounds like a good job for an intern.

=)

Call your host and see if you can work out a deal for doing a shell execute.

answered Sep 7, 2008 at 16:39

FlySwatFlySwat

175k75 gold badges248 silver badges314 bronze badges

I managed to solve this problem on my own. I put the following lines in a file named visitors.cgi:
#!/bin/sh

printf "Content-type: text/html\n\n"


exec visitors -A /home/logs/access_log

answered Sep 7, 2008 at 19:49


Kyle CroninKyle Cronin

78.9k45 gold badges151 silver badges167 bronze badges

You might also like