PHP5.3(作为 Apache 模块)无法写入 /var/www///cache

发布于 2024-12-26 12:15:27 字数 1592 浏览 0 评论 0原文

请耐心阅读,因为问题看起来很明显,但只是看起来。 情况是:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城缀染半城烟沙 2025-01-02 12:15:27

禁用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文