PHP的mkdir()权限 [英] PHP mkdir() permissions

查看:183
本文介绍了PHP的mkdir()权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Linux服务器与appache作为Web服务器。在我的PHP脚本我正在与 0777 模式目录。在code是pretty简单如下:

I have a Linux server with appache as the web server. In my PHP script I am making directories with 0777 mode. the code is pretty simple as follows:

mkdir($path,0777)

当我运行此脚本,去到我的服务器的文件管理器,文件夹是有,但分配给该文件夹的权限是0755。我想不通为什么会这样!在创建文件夹时,用户已列在apache的,但它的权限是0755。

when I run this script and go to my server file manager, the folder is there but the permission assigned to that folder is 0755. I can't figure out why this is happening!! when the folder is created the user column has apache in it but the permission is 0755.

推荐答案

您应该尝试的umask

$old = umask(0); 
mkdir($path,0777); 
umask($old); 

这篇关于PHP的mkdir()权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆