简体   繁体   English

Apache和PHP文件夹权限

[英]Apache & PHP folder permissions

Our PHP scripts create dynamic folders and files and we are having a permission issue. 我们的PHP脚本创建了动态文件夹和文件,并且存在权限问题。 The folders were initially create using our ftpuser. 这些文件夹最初是使用我们的ftpuser创建的。 EG: Album (created by ftpuser) all subfolders and files in them have to be dynamically created. EG:相册(由ftpuser创建)必须动态创建其中的所有子文件夹和文件。 The apache user is the user when a new folder is created and then it cannot write anything to that folder for some reason. apache用户是创建新文件夹后由于某种原因无法将任何内容写入该文件夹的用户。

The server is running with PHP safe mode OFF. 服务器在PHP安全模式为OFF的情况下运行。

Whenever a folder is created by php script the user is apache and the permission for some reason shows as dr----x--t 每当使用php脚本创建文件夹时,用户都是apache,由于某种原因,权限显示为dr ---- x--t

Thanks. 谢谢。

Find the place in the PHP where the folder is created. 在PHP中找到创建文件夹的位置。 Typically, this will be: 通常,这将是:

mkdir( folderName );

Change the line to: 将行更改为:

mkdir( folderName, 1755 );

Or, instead, add this line after the mkdir : 或者,而是在mkdir之后添加以下行:

chmod( folderName, 1755 );

For more information, here's the PHP mkdir documentation . 有关更多信息,请参见PHP mkdir文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM