我有一个文件/root/update/test.php。还有一个文件/root/connect.php; 这个文件有一行
include "../config.php";
/root/update/test.php中有以下代码
set_include_path(".:/root");
include "connect.php";
当我运行 /root/update/test.php 时,它可以找到 connect.php 文件,但无法找到 config.php 文件,导致出现以下错误信息:
PHP Warning: include(../config.php): failed to open stream: No such file or directory in /root/connect.php on line 2
PHP Warning: include(): Failed opening '../config.php' for inclusion (include_path='.:/root')
这让我感到很困惑,因为警告信息让我觉得我做的一切都是正确的 - 包含路径是 /root,它正在寻找 ../config.php (/config.php) 文件,而该文件确实存在。有人能帮我澄清一下吗?请注意,由于部署到我无法访问的生产服务器上,使用绝对路径不是我的选择。
Ubuntu/Apache