我有文件/root/update/test.php。还有一个文件/root/connect.php;此文件有一行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 /阿帕奇
我试图包含config.php相对于你的CWD,它是/ root/update /,并且搜索/root/config.php – user4035
这个:include“../config.php”带你到文件夹是根文件夹的父级。 config.php位于那里吗? – Gimmy
config.php的完整路径是什么? – meiamsome