<?php //建立test文件夹 $addtime=date("Ymd",time()); $testdir="./test/"; if(file_exists ($testdir)): else: mkdir ($testdir, 0777); @chmod ($testdir, 0777) endif; ?> 可以正常建立test文件夹,且属性为777.<?php //建立test.php fopen("test.php","a+") or die('sss'); ?>错误提示: Warning: fopen(): SAFE MODE Restriction in effect. The script whose uid is 532 is not allowed to access /html/worldzf/upload/upload owned by uid 48 in /html/worldzf/upload/upload/fopena.php on line 2Warning: fopen(test.php): failed to open stream: No such file or directory in /html/worldzf/upload/upload/fopena.php on line 2 sss
执行fopen命令不能给此文件夹建立新文件。
但是用ftp软件可以给此文件夹上传文件。
但是通过http访问这个文件夹里的fopen文件却不能执行fopen功能,建立新文件失败。
2.文件夹属性是否可读写;
3.fopen 中提供的文件名是否存在此文件!
就是想在这个文件夹里通过php语句建立新文件。
现在向这个文件夹里通过@move_uploaded_file上传图片也不行。
可以检测有没有这个文件,没有就自行建立新文件的吧。
所以在ftp能操作不一定php用户就能操作.
还有路径方面你需要注意!
//建立test文件夹
$addtime=date("Ymd",time());
$testdir="./test/";
if(file_exists ($testdir)):
else:
mkdir ($testdir, 0777);
@chmod ($testdir, 0777)
endif;
?>
可以正常建立test文件夹,且属性为777.<?php
//建立test.php
fopen("test.php","a+") or die('sss');
?>错误提示:
Warning: fopen(): SAFE MODE Restriction in effect. The script whose uid is 532 is not allowed to access /html/worldzf/upload/upload owned by uid 48 in /html/worldzf/upload/upload/fopena.php on line 2Warning: fopen(test.php): failed to open stream: No such file or directory in /html/worldzf/upload/upload/fopena.php on line 2
sss
可不可以在语句上进行修改来实现?
{
@mkdir($testdir, 0777);
}
if(@$fp = fopen("test.php","a+"))
{
//....
}在同一个文件中呢
解决了,设立了safe_mode_exec_dir。谢谢参与,给分。