php写过的文件权限问题
php程序写完文件,原文件由755权限变为了777,服务器禁止777文件运行,这就导致了矛盾,总是500错误,如何控制写入后文件权限问题?...
php程序写完文件,原文件由755权限变为了777,服务器禁止777文件运行,这就导致了矛盾,总是500错误,如何控制写入后文件权限问题?
展开
2个回答
展开全部
Usage: chmod [OPTION]... MODE[,MODE]... FILE...
or: chmod [OPTION]... OCTAL-MODE FILE...
or: chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.
-c, --changes like verbose but report only when a change is made
--no-preserve-root do not treat `/' specially (the default)
--preserve-root fail to operate recursively on `/'
-f, --silent, --quiet suppress most error messages
-v, --verbose output a diagnostic for every file processed
--reference=RFILE use RFILE's mode instead of MODE values
<<<<<
-R, --recursive change files and directories recursively
--help display this help and exit
--version output version information and exit
>>>>>>
Each MODE is of the form `[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.
Report chmod bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report chmod translation bugs to <http://translationproject.org/team/>
For complete documentation, run: info coreutils 'chmod invocation'
or: chmod [OPTION]... OCTAL-MODE FILE...
or: chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.
-c, --changes like verbose but report only when a change is made
--no-preserve-root do not treat `/' specially (the default)
--preserve-root fail to operate recursively on `/'
-f, --silent, --quiet suppress most error messages
-v, --verbose output a diagnostic for every file processed
--reference=RFILE use RFILE's mode instead of MODE values
<<<<<
-R, --recursive change files and directories recursively
--help display this help and exit
--version output version information and exit
>>>>>>
Each MODE is of the form `[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.
Report chmod bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report chmod translation bugs to <http://translationproject.org/team/>
For complete documentation, run: info coreutils 'chmod invocation'
追问
这是?
追答
chmod 的帮助文档
-R, --recursive change files and directories recursively
--help display this help and exit
--version output version information and exit
这参数可以循环。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
chmod(文件路径,755)
更多追问追答
追问
如何递归让整个目录,子目录,文件权限都是755?
追答
$i=system('chmod -R 目录 755',$v);
或
function myScandir($actual_dir){
$scanDir = scandir($actual_dir);
for ($i=0;$i<count($scanDir);$i++){
if ( $scanDir[$i] == '.' || $scanDir[$i] == '..' ) {
continue;
}
if (is_file($actual_dir.'/'.$scanDir[$i])){
chmod($actual_dir.'/'.$scanDir[$i],755);
} elseif (is_dir($actual_dir.'/'.$scanDir[$i])){
$dir = $scanDir[$i];
chmod($actual_dir.'/'.$scanDir[$i],755);
myScandir( "$actual_dir/$dir" );
}
}
return true;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询