【发布时间】:2014-01-17 05:00:00
【问题描述】:
我正在尝试编写一个脚本来创建虚拟主机 vor apache(AWS 上的 CentOS 6.4) 我试过简单的写:
$result = file_put_contents( '/etc/httpd/conf/vhosts/test.conf', 'teststring');
var_dump($result);
这是我的许可和所有者信息:
-rw-r--r--. 1 apache apache 34445 Jan 16 11:08 httpd.conf
-rw-r--r--. 1 apache apache 13139 Aug 13 17:30 magic
drwxrwxrwx. 2 apache apache 4096 Jan 17 04:29 vhosts
但我仍然收到此消息:
Warning: file_put_contents(/etc/httpd/conf/vhosts/test.conf): failed to open stream: Permission denied in /var/www/server-control/src/test.php on line 8 bool(false)
通过ps aux|grep httpd检查用户:
root 9804 0.0 0.0 246372 8712 ? Ss 03:57 0:00 /usr/sbin/httpd
apache 9808 0.0 0.0 247024 7972 ? S 03:57 0:00 /usr/sbin/httpd
apache 9809 0.0 0.0 248304 8644 ? S 03:57 0:00 /usr/sbin/httpd
apache 9810 0.0 0.0 247536 7872 ? S 03:57 0:00 /usr/sbin/httpd
apache 9811 0.0 0.0 247536 8020 ? S 03:57 0:00 /usr/sbin/httpd
apache 9812 0.0 0.0 247536 7876 ? S 03:57 0:00 /usr/sbin/httpd
apache 9813 0.0 0.0 247536 7948 ? S 03:57 0:00 /usr/sbin/httpd
请帮忙!!有些服务器我可以通过将所有者更改为apache 来写入该文件夹,但这个不是。
【问题讨论】:
标签: php apache permissions