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.
我一直在为我的网站寻找不同的网络统计程序,其中一个很有前途的是访问者。不幸的是,它是一个C程序,我不知道如何从Web服务器调用它。我尝试过使用PHP的shell_exec,但是我的网络主机(NFSN)上安装了PHP的安全模式并且它给了我一条错误信息。
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)
有没有办法在安全模式下执行程序?如果没有,它可以与CGI一起使用吗?如果是这样,怎么样? (我之前从未使用过CGI)
5 个解决方案
#1
1
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.
访客看起来像日志分析器和报告生成器。它可能是最好的设置,作为一个chron作业,每天创建一次静态HTML页面。
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.
如果您没有shell访问您的主机帐户,或者某种控制面板可以让您设置chron作业,那么您将失去运气。
#2
0
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.
有没有理由不使用Google Analytics?它是免费的,你不必自己写。我用它,它给你很多信息。
Sorry, I know it's not a "programming" answer ;)
对不起,我知道这不是“编程”的答案;)
#3
0
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).
我是Jonathan的回答:这是一个日志分析器,这意味着您必须将其作为输入提供给Web服务器的日志文件,并生成它的摘要。鉴于您位于共享主机上,您无法访问该文件,即使您要访问该文件,也很可能它包含给定计算机上托管的所有网站的条目(设置单独的日志记录)对于每个VirtualHost当然可以使用Apache,但我不知道这是否是一种常见做法)。
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.
一种可能的解决方法是让您从页面中写出日志文件。然而,这是相当困难的,并且可能会产生严重的性能影响(如果您不希望不时地获取垃圾,则必须将对日志文件的写入序列化为一个)。总而言之,我建议使用Google Analytics等在线分析服务。
#4
0
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.
幸运的是,我有权访问我网站的日志文件。我已经能够手动在服务器上生成HTML页面了 - 我一直在寻找一种让它自动发生的方法。我只需要执行一个shell命令并将输出显示为页面。
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.
打电话给你的主机,看看你是否可以为执行shell执行交易。
#5
0
I managed to solve this problem on my own. I put the following lines in a file named visitors.cgi:
我设法自己解决了这个问题。我将以下行放在名为visitor.cgi的文件中:
#!/bin/sh
printf "Content-type: text/html\n\n"
exec visitors -A /home/logs/access_log
#1
1
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.
访客看起来像日志分析器和报告生成器。它可能是最好的设置,作为一个chron作业,每天创建一次静态HTML页面。
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.
如果您没有shell访问您的主机帐户,或者某种控制面板可以让您设置chron作业,那么您将失去运气。
#2
0
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.
有没有理由不使用Google Analytics?它是免费的,你不必自己写。我用它,它给你很多信息。
Sorry, I know it's not a "programming" answer ;)
对不起,我知道这不是“编程”的答案;)
#3
0
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).
我是Jonathan的回答:这是一个日志分析器,这意味着您必须将其作为输入提供给Web服务器的日志文件,并生成它的摘要。鉴于您位于共享主机上,您无法访问该文件,即使您要访问该文件,也很可能它包含给定计算机上托管的所有网站的条目(设置单独的日志记录)对于每个VirtualHost当然可以使用Apache,但我不知道这是否是一种常见做法)。
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.
一种可能的解决方法是让您从页面中写出日志文件。然而,这是相当困难的,并且可能会产生严重的性能影响(如果您不希望不时地获取垃圾,则必须将对日志文件的写入序列化为一个)。总而言之,我建议使用Google Analytics等在线分析服务。
#4
0
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.
幸运的是,我有权访问我网站的日志文件。我已经能够手动在服务器上生成HTML页面了 - 我一直在寻找一种让它自动发生的方法。我只需要执行一个shell命令并将输出显示为页面。
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.
打电话给你的主机,看看你是否可以为执行shell执行交易。
#5
0
I managed to solve this problem on my own. I put the following lines in a file named visitors.cgi:
我设法自己解决了这个问题。我将以下行放在名为visitor.cgi的文件中:
#!/bin/sh
printf "Content-type: text/html\n\n"
exec visitors -A /home/logs/access_log