作者marphling (就是你)
看板PHP
標題[請益] 關於伺服器設定
時間Wed Apr 4 17:44:26 2007
我目前用阿帕契
但是在創造檔案的時候 會一直創造不出來
請問一下 是阿帕契裡面有哪些需要設定的嗎?
下面是PHP程式碼
<?php
$counterFile = "/tmp/counter.txt";
function displayCounter($counterFile) {
$fp = fopen($counterFile,"rw");
$num = fgets($fp,5);
$num += 1;
print "您是第 "."$num"." 位無聊份子";
exec( "rm -rf $counterFile");
exec( "echo $num > $counterFile");
}
if (!file_exists($counterFile)) {
exec( "echo 0 > $counterFile");
}
displayCounter($counterFile);
?>
跑出來的網頁如下
Warning: fopen(/tmp/counter.txt) [function.fopen]:
failed to open stream: No such file or directory
in C:\AppServ\www\lovewen\test.php on line 19
Warning: fgets(): supplied argument is not a valid stream resource
in C:\AppServ\www\lovewen\test.php on line 20
您是第 1 位無聊份子
請幫忙解答謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.91.104.150
推 allanshen:沒有 /tmp 這個目錄 04/04 17:49
推 marphling:請問 /tmp 是在網頁所處的資料夾嗎? 04/04 17:57
→ marphling:已解決 感恩 04/04 18:03