2014-03-13 82 views
-2

include "/directory/filename.php"写出错误
include "directory/filename.php"找到它。包含“/directory/filename.php”未找到。包括“directory/filename.php”找到。为什么?

我想升级我们的服务器硬件,并将apache/php/pgsql安装到新服务器上。

在旧的硬件上,第一个包含的代码完美运行,所以我猜想我的php.ini文件中有错误。

我试图改变include_path在我php.ini,它没有任何效果

Warning: include_once(/class/class_masterplan.php) [function.include-once]: failed to open stream: No such file or directory in D:\PHP\work.php on line 218

Warning: include_once() [function.include]: Failed opening '/class/class_masterplan.php' for inclusion (include_path='.;D:\php') in D:\PHP\work.php on line 218

Fatal error: Class 'masterplan' not found in D:\PHP\work.php on line 219

我想知道,配置变量会导致什么服务器/解决这个问题。

回答

1

因为如果您使用前导斜杠,应用程序会认为它是绝对路径,而不是。如果你省略了这个斜杠,你正在使用相对路径。另请参阅:http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm

+0

如果我使用绝对路径,是不是应该从DOCUMENT_ROOT搜索? – LaczkoUr

+0

我不知道确切了,但我认为这取决于您的系统配置。我想你想要的是从你的域名/网站的根目录开始。还有更多关于这方面的文章。祝你好运! –