PHP5.3(作为 Apache 模块)无法写入 /var/www///cache
请耐心阅读,因为问题看起来很明显,但只是看起来。 情况是:
1.
OS: fedora-16 (latest),
httpd: apache-2.2.21,
php: php-5.3.8 (works as apache's module)
2. 主机信息:
DOCUMENT_ROOT: /var/www/[site-name]/public_html
Kohana-3.2.0 (latest stable) installed this way:
$ pwd
/var/www/<site-name>
$ ls -alp
drwxr-xr-x. 6 apache apache 4096 Jan 7 20:35 ./
drwxr-xr-x. 8 apache apache 4096 Jan 7 20:08 ../
drwxr-xr-x. 9 apache apache 4096 Jul 25 03:26 application/
drwxr-xr-x. 10 apache apache 4096 Jul 25 03:26 modules/
drwxr-xr-x. 2 apache apache 4096 Jan 7 20:35 public_html/
drwxr-xr-x. 11 apache apache 4096 Jul 25 03:26 system/
$ cd application/; ls -alp
drwxr-xr-x. 9 apache apache 4096 Jul 25 03:26 ./
drwxr-xr-x. 6 apache apache 4096 Jan 7 20:35 ../
-rwxr-xr-x. 1 apache apache 3612 Jul 25 03:22 bootstrap.php
drwxrwxrwx. 2 apache apache 4096 Jan 8 20:14 cache/
drwxr-xr-x. 4 apache apache 4096 Jul 25 03:26 classes/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 config/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 i18n/
drwxrwxrwx. 2 apache apache 4096 Jul 25 03:26 logs/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 messages/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 views/
Command `top` says that Apache is really starts under `apache` user privileges.
那么如何才能使 application/cache 和 application/logs 目录不可写呢? - 我也检查过它们,
var_dump(fopen($_SERVER['DOCUMENT_ROOT'] . '/../application/cache/something.txt', 'w+'));
结果相同。不知道怎么会这样。没有符号链接,没有安装的驱动器等。 有人遇到过这样的情况吗?
Please, be patient while reading, because the problem is seems to be transparent but just only seems.
The situation is:
1.
OS: fedora-16 (latest),
httpd: apache-2.2.21,
php: php-5.3.8 (works as apache's module)
2.
host information:
DOCUMENT_ROOT: /var/www/[site-name]/public_html
Kohana-3.2.0 (latest stable) installed this way:
$ pwd
/var/www/<site-name>
$ ls -alp
drwxr-xr-x. 6 apache apache 4096 Jan 7 20:35 ./
drwxr-xr-x. 8 apache apache 4096 Jan 7 20:08 ../
drwxr-xr-x. 9 apache apache 4096 Jul 25 03:26 application/
drwxr-xr-x. 10 apache apache 4096 Jul 25 03:26 modules/
drwxr-xr-x. 2 apache apache 4096 Jan 7 20:35 public_html/
drwxr-xr-x. 11 apache apache 4096 Jul 25 03:26 system/
$ cd application/; ls -alp
drwxr-xr-x. 9 apache apache 4096 Jul 25 03:26 ./
drwxr-xr-x. 6 apache apache 4096 Jan 7 20:35 ../
-rwxr-xr-x. 1 apache apache 3612 Jul 25 03:22 bootstrap.php
drwxrwxrwx. 2 apache apache 4096 Jan 8 20:14 cache/
drwxr-xr-x. 4 apache apache 4096 Jul 25 03:26 classes/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 config/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 i18n/
drwxrwxrwx. 2 apache apache 4096 Jul 25 03:26 logs/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 messages/
drwxr-xr-x. 2 apache apache 4096 Jul 25 03:26 views/
Command `top` says that Apache is really starts under `apache` user privileges.
So how can I have that application/cache and application/logs directories are unwritable? - I've checked them also with
var_dump(fopen($_SERVER['DOCUMENT_ROOT'] . '/../application/cache/something.txt', 'w+'));
Same result. Have no idea how it could be. No symlinks, no mounted drives etc.
Have anyone met such a situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
禁用 selinux (http://www.crypt.gen.nz/selinux/disable_selinux.html< /a>)。
顺便说一句,从安全角度来看,让 apache 成为 .php 文件的所有者是一个非常糟糕的主意
Disable selinux (http://www.crypt.gen.nz/selinux/disable_selinux.html).
BTW from security standpoint, it's a very bad idea to make apache owner of .php files