Search code examples
statisticscgianalyticsvisitorsphp-safe-mode

Call Visitors web stat program from PHP


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)


Solution

  • 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