本文介绍了PHP mkdir 0777失败chmod 0777正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用PHP 5.2.14,会发生这种情况
using PHP 5.2.14, this is what happens
[user@VE213 public_html]$ php -r "mkdir('directory', 0777);"
[user@VE213 public_html]$ ls -lt
drwxrwxr-x 2 rankranger rankranger 4096 Dec 8 17:28 directory
[user@VE213 public_html]$ php -r "chmod('directory', 0777);"
[user@VE213 public_html]$ ls -lt
drwxrwxrwx 2 rankranger rankranger 4096 Dec 8 17:28 directory
在php bug列表中找不到任何相关的bug,知道吗?
Did not find any related bugs in the php bug list, any idea?
推荐答案
$old = umask(0);
mkdir($dir,0777);
umask($old);
阅读此书, http://php.net/manual/en/function.mkdir.php
此外,检查您创建新目录的顶层目录.
Additional, Check the top directory that you make new directory.
示例)
$dir="/data/log/query";
$old = umask(0);
mkdir($dir,0777);
umask($old);
这篇关于PHP mkdir 0777失败chmod 0777正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!