[root@dywang ~]# cd /var/www/html/ [root@dywang html]# wget http://www.cellbiol.com/scripts/free-counter-script/counter.zip
[root@dywang html]# unzip counter.zip Archive: counter.zip creating: counter/ inflating: counter/.DS_Store creating: __MACOSX/ creating: __MACOSX/counter/ inflating: __MACOSX/counter/._.DS_Store inflating: counter/counter.php inflating: __MACOSX/counter/._counter.php inflating: counter/counter.txt inflating: __MACOSX/counter/._counter.txt inflating: counter/readme.txt inflating: __MACOSX/counter/._readme.txt inflating: counter/visitors_ips.txt inflating: __MACOSX/counter/._visitors_ips.txt
[root@dywang html]# ll counter total 20 -rw-r--r--. 1 root root 4703 Feb 16 2013 counter.php -rw-r--r--. 1 root root 1 Feb 16 2013 counter.txt -rw-r--r--. 1 root root 2137 Feb 16 2013 readme.txt -rw-r--r--. 1 root root 25 Feb 16 2013 visitors_ips.txt
counter.txt
IP 訪問時間儲存在 visitors_ips.txt
,所以必須將這兩個檔案的攡有者改為 apache,讓 apache 用戶可以寫入。不建議直接將這兩個檔案的權限改成 666 或 777,雖然一樣可以讓網頁存取用戶 apache 寫入,但在這個系統中的其他用戶也一樣可以寫入。
[root@dywang html]# chown apache counter/counter.txt counter/visitors_ips.txt [root@dywang html]# ll counter total 20 -rw-r--r--. 1 root root 4771 Jan 3 12:00 counter.php -rw-r--r--. 1 apache root 6 Jan 4 18:25 counter.txt -rw-r--r--. 1 root root 2137 Feb 16 2013 readme.txt -rw-r--r--. 1 apache root 27 Jan 4 18:25 visitors_ips.txt
http://dywang.csie.cyut.edu.tw
改成您 webcounter 所架設的網址。
<img src="http://dywang.csie.cyut.edu.tw/counter/counter.php" alt="page counter" title="Single visitors since 12345" style="width:140px;">