php 如何chmod文件夹以使其可在php中为服务器写入

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9432990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 06:48:45  来源:igfitidea点击:

How to chmod the folder to make it writable for the server in php

phppermissionschmod

提问by Bader

How to chmod the folder to make it writable for the server in php ?

如何修改文件夹以使其可在 php 中写入服务器?

I am using this function chomd as following

我正在使用这个函数 chomd 如下

chmod("/images/original", 0750);

but still don't have the permission to write file . why ?

但仍然没有写入文件的权限。为什么 ?

回答by Chris

If the user your webserver runs on has no write access then it most likely is not the owner of the file, and therefore it cannot change permissions either.

如果您的网络服务器运行的用户没有写访问权限,那么它很可能不是文件的所有者,因此它也不能更改权限。

To allow write access on the file for your webserver process either change the ownership (chown) or allow sufficient write permissions (chmod) on a shell.

要允许您的网络服务器进程对文件进行写访问,请更改所有权 ( chown) 或chmod在 shell 上允许足够的写权限 ( )。

回答by Saiyam Patel

try

尝试

chmod("/images/original", 0777);