PHP mkdir 和 apache 所有权 [英] PHP mkdir and apache ownership

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

问题描述

有没有办法设置在 apache 下运行的 php 来创建文件夹,该文件夹由创建它的程序的所有者拥有,而不是由 apache 拥有?

Is there a way to set php running under apache to create folders with the folder owned by the owner of the program that creates it instead of being owned by apache?

使用 wordpress 会创建新的文件夹来上传,但这些文件夹由 apache.apache 拥有,而不是由它们运行的​​站点拥有.这也发生在使用 ostickets 时.现在我们必须通过 SSH 连接到服务器并 chmod 文件夹,但似乎有一个设置可以覆盖任何执行此操作的程序之外的所有权.

Using word press it creates new folders to upload into but these are owned by apache.apache and not by the site that they are running in. This also happens using ostickets. For now we have to SSH into the server and chmod the folder, but it would seem there would be a setting somewhere to override the ownership outside of any program that does it.

推荐答案

Safe_mode 在您的服务器上打开.函数 mkdir() 使用不同于当前脚本所有者的所有者(apache"、none"、..)创建文件夹.并且脚本无法将文件上传(移动、复制)到另一个所有者(不同于当前脚本所有者)的文件夹中.

Safe_mode is turn on on your server. The function mkdir() creates folder with owner ("apache", "none", ..) that different of the current script owner. And scripts couldn't upload (move, copy) files into that folder with another owner (that is not like current script owner).

禁用 safe_mode 就可以了.

请参阅http://php.net/manual/en/features.safe-mode.php 了解详情.

附言启用 safe_mode 你不能在 php 中使用 chmod() 函数.

P.S. With enable safe_mode you can't use chmod() function in php.

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

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