文件结构(fyi我在linux服务器上)
错误:
Warning: include(./Setup/Setup.php) [function.include]: failed to open stream: No such file or directory in /home/content/22/10350022/html/templates/Home.php on line 1
Warning: include() [function.include]: Failed opening './Setup/Setup.php' for inclusion (include_path='.:/usr/local/php5_3/lib/php') in /home/content/22/10350022/html/templates/Home.php on line 1
我已经尝试了几种不同的方法来访问这个安装文件。
tried: include('/Setup/Setup.php') - same error
tried: __DIR__. '/Setup/Setup.php'
tried: $_SERVER [SITEROOT] and some other variations including the total path.
tried: Include = path ".:/Setup/Setup.php"
三者都产生了相同的误差,只差一个。错误中显示的路径包括:/var/chrot/home//Setup/Setup.php
我很难理解这里发生了什么。我对PHP不是很精通,所以我不太确定如何最小化相对路径和绝对路径。
当我告诉它在/Setup中查找时,它为什么在我的/templates文件夹中查找?
谢谢!
确保路径正确:
include($_SERVER['DOCUMENT_ROOT']."/Setup/Setup.php");
确保PHP用户拥有权限:
777的临时chmod和测试
chmod 777 /home/content/22/10350022/html/templates/Setup/Server.php
试试这个:
include('Setup/Setup.php');
上面的例子应该很好用。但是,由于不知道如何包含文件和结构,您可能需要使用../
跳回目录。确保你的文件也是可读的。