简体   繁体   English

PHP的Apache根写权限

[英]php apache root write permission

Can i write /etc/apache2/ directory. 我可以写/ etc / apache2 /目录吗? I want to create a file with php and apache. 我想用php和apache创建一个文件。 But i must root. 但是我必须扎根。 Is there a way to sudoers? 有办法解决吗?

Can do this? 能做到吗

You can change the group of /etc/apache2 to the same group that apache runs as and give the group write permission. 您可以将/ etc / apache2的组更改为apache运行所在的组,并授予该组写权限。 This might be safer than trying to su with php and a system call. 这可能比尝试使用php和系统调用进行su更安全。

Any directory that you want the Apache process to write to needs to be writable by the user that the Apache daemon runs as. 您希望Apache进程写入的任何目录都必须由运行Apache守护程序的用户写。 So you either need to make the directory world-writable (ie chmod 777) or owned by the Apache user. 因此,您需要使目录可全局写入(即chmod 777)或由Apache用户拥有。

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

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