QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1091|回复: 2

php的问题啊

[复制链接]
发表于 2003-10-13 21:21:25 | 显示全部楼层 |阅读模式
1.php内容如下:
<html>
<head>
<title>网页计数器</title>
</head>
<body>
&lt;?
//数字输出的网页计数器
$max_len=8;
$CounterFile="counter.dat";
if(!file_exists($CounterFile))
{$counter=0;
$cf=fopen($CounterFile,"w");
fputs($cf,"0");
fclose($cf);
}
else
{$cf=fopen($CounterFile,"r");
$counter=trim( fgets($cf,$max_len) );
fclose($cf);
}
$counter++;
$cf=fopen($CounterFile,"w");
fputs($cf,$counter);
fclose($cf);
?&gt;
</body>
&lt;/html&gt;
可是我从浏览器里浏览的话得到以下结果:
Warning: fopen(counter.txt): failed to open stream: Permission denied in
/home/httpd/1.php on line 12

Warning: fputs(): supplied argument is not a valid stream resource in
/home/httpd/1.php on line 13

Warning: fclose(): supplied argument is not a valid stream resource in
/home/httpd/1.php on line 14

Warning: fopen(counter.txt): failed to open stream: Permission denied in
/home/httpd/1.php on line 22

Warning: fputs(): supplied argument is not a valid stream resource in
/home/httpd/1.php on line 23

Warning: fclose(): supplied argument is not a valid stream resource in
/home/httpd/1.php on line 24
Resource id #2
为什么?多谢
发表于 2003-10-14 14:22:51 | 显示全部楼层
Permission denied :权限不够
解决方法:
1、新建本文件,修改文件权限为 0666
2、修改本目录属性为 0666
3、将本文件夹或文件的所有者设为服务器所使用的用户(一般为nobody)
4、修改服务器所使用的用户
回复

使用道具 举报

 楼主| 发表于 2003-10-22 16:57:03 | 显示全部楼层
恩.可以了多谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-5-14 06:41 , Processed in 0.078222 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表