【发布时间】: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/网络