PHP5.3(作为Apache模块)无法写入/ var / www / <project-name> / <document-root> / cache </document-root> </project-name>

时间:2012-01-13 21:54:39

标签: php linux apache fedora privileges

请在阅读时保持耐心,因为问题似乎是透明的,但似乎只是看起来。 情况是:

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.

那么我怎么能让那个应用程序/缓存和应用程序/日志目录不可写? - 我也用

检查了它们
var_dump(fopen($_SERVER['DOCUMENT_ROOT'] . '/../application/cache/something.txt', 'w+'));

结果相同。不知道它是怎么回事。没有符号链接,没有安装驱动器等。 有没有人遇到过这种情况?

1 个答案:

答案 0 :(得分:0)

禁用selinux(http://www.crypt.gen.nz/selinux/disable_selinux.html)。

从安全的角度看BTW,制作.php文件的apache所有者是一个非常糟糕的主意