需要帮助了解 PHP 应用程序的文件权限设置
我在 Macintosh 上使用 MAMP 开发了一个应用程序
,当我将其上传到由 Cpanel11、CentOS 5 提供支持的服务器时。默认情况下,它会给出几个有关文件权限的错误,它为大多数文件提供 0700 文件权限,但在该应用程序中不起作用我的服务器。我想知道如何为我的 PHP 应用程序应用文件权限设置,
我想要应用的目录结构或规则适用于以下条件。
a) 文件上传目录
b) 大多数php 文件都使用include_once()
c) 相互通信的普通php 文件。
谢谢
i have developed an application on Macintosh using MAMP
when i upload it to the server which is powered by Cpanel11, CentOS 5.. it gives several error regarding file permissions by default it gives 0700 file permission to most of the files which does not work within my server. i would want to know how do i apply the file permission settings for my PHP application,
the directory structure or the rule i want to apply is for the following conditions.
a)File uploading Directory
b) most of the php file is using include_once()
c) the normal php files which communicates with each other.
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PHP 中的文件上传首先到达定义的临时目录(请参阅 PHP.ini 中的“upload_tmp_dir”指令),最后到达预期的目标目录(PHP 命令“move_uploaded_file”)。
您的 PHP 进程以需要拥有目标目录的特定用户身份运行,或者属于允许写入该目录的组 - 除非整个目录不是每个人都可写的(这不是您的情况)。
File uploads in PHP first hit the defined temporary directory (see 'upload_tmp_dir' directive in your PHP.ini) and finally your intended destination directory (PHP command "move_uploaded_file").
Your PHP process runs as a certain user that needs to own the destination directory or is in a group that is allowed to write to this directory - unless the whole directory is not writable for everyone (it's not in your case).
在
move_uploaded_file
之后尝试chmod
。Try
chmod
aftermove_uploaded_file
.