[英] PHP include relative path
我有文件/根/更新/测试.php.还有一个文件,/root/connect.php;这个文件有一行
include "../config.php";
在/root/update/test中.php.这是密码
set_include_path(".:/root");
include "connect.php";
当我运行/root/update/test时.php,它找到了connect.php,但找不到配置.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')
这让我很困惑,因为警告让我觉得我做的每件事都是正确的——include路径是/root,它正在查找文件/配置.php(/config.php),它存在.有人能帮我澄清一下吗?请注意,使用绝对路径对我来说不是一个选项,因为要部署到我无权访问的生产服务器.
Ubuntu/Apache