【问题标题】:PHP is_readable returns false on readable file on apache2PHP is_readable 在 apache2 上的可读文件上返回 false
【发布时间】:2016-10-15 20:36:13
【问题描述】:

无法将旧 joombla 迁移到另一台服务器,因为 php 无法读取配置文件。 :S

出于测试原因,我编写了以下代码:

clearstatcache();
echo substr(sprintf('%o', fileperms('configuration2.php')), -4);

if(file_get_contents("configuration.php")) echo " trae conent";
else echo " no trae un joraca ";

if (is_readable('configuration.php')) {
  echo 'The file is readable';
} else {
  echo ' NOOOOO ';
}

readfile('configuration2.php'); 
exit();

返回:

0no trae un joraca NOOOOO

ls:

-rwxrwxrwx 1 www-data www-data 2189 jun 14 18:16 configuration.php

apache2 作为 www-data:www-data 运行

www-数据 10194 0.0 0.1 25940 3336 ? S 19:19 0:00 /usr/sbin/apache2 -k 开始

.htaccess 已删除

为什么文件不可读?我已经检查了 .htaccess、chmod 和 chown 问题。

【问题讨论】:

  • PHP 是否也作为 www-data 运行?话虽如此,路径是否正确?
  • 你确定你在正确的工作目录中吗?
  • 我发现了这个:[Sun Jun 12 22:12:12 2016] [warn] [client 1---1] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir 限制生效。文件(configuration.php)不在允许的路径中:(/var/ww---/web:/var/w---0/web20/tmp:/var/www/inm--ne. com/网络

标签: php apache2


【解决方案1】:

我发现了这个:

[Sun Jun 12 22:12:12 2016] [warn] [client 1---1] mod_fcgid: stderr: PHP Warning: file_exists(): open_basedir restriction in effect. File(configuration.php) is not within the allowed path(s): (/var/ww---/web:/var/w---0/web20/tmp:/var/www/inm--ne.com/web

什么解释了错误:D

【讨论】:

    猜你喜欢
    • 2012-12-22
    • 1970-01-01
    • 1970-01-01
    • 2011-06-05
    • 2011-04-09
    • 2014-04-24
    • 2013-07-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多