0

文件结构(仅供参考,我在 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/chroot/home/.../Setup/Setup.php

我很难理解这里发生了什么。我对 PHP 不是很精通,所以我不确定如何最小化相对路径和绝对路径。

当我告诉它在 /Setup 中查找时,为什么它在我的 /templates 文件夹中查找?

谢谢!

4

2 回答 2

1

Make sure the path is right:

   include($_SERVER['DOCUMENT_ROOT']."/Setup/Setup.php");

Make sure the PHP user has rights:

Temporary chmod to 777 and test

   chmod 777 /home/content/22/10350022/html/templates/Setup/Server.php
于 2013-07-12T21:25:51.030 回答
0

Try this:

include('Setup/Setup.php');

The above example should work nicely. However, not knowing how you are including the file and your structure you may need to jump back directories by using ../. Make sure your file is readable as well.

于 2013-07-12T21:26:58.433 回答