【发布时间】:2011-08-29 17:22:26
【问题描述】:
我在部署网站时遇到问题。我一直在 Windows 下使用 WAMP 构建它,现在我正在部署到 Linux。
这样的代码适用于 Windows:
req.php
echo "This is req<br>";
ini_set("include_path", "/home/clash/public_html/:".get_include_path());
require "/req1.php";
req1.php
echo "This is req1";
但在生产环境中失败并显示消息:
警告:require(/req1.php) [function.require]:无法打开流: 第 5 行的 /home/clash/public_html/req.php 中没有这样的文件或目录
致命错误:require() [function.require]:需要打开失败 '/req1.php' (include_path='/home/clash/public_html/:.:/usr/lib/php:/usr/local/lib/php') 在 /home/clash/public_html/req.php 第 5 行
ini_set 中的路径是网站在服务器文件系统上的实际位置的路径。
我不想避免使用绝对路径,因为我使用的库在某种程度上依赖于它们。
我确定我在这里遗漏了一些非常简单的东西,但我不知道是什么。
谢谢!
【问题讨论】: