错误:require():打开所需文件失败

时间:2013-05-12 08:30:54

标签: php

当我尝试包含文件时,我收到以下错误..我已经尝试了chmod 777目录。检查两次,路径是正确的..但仍然是错误仍然存​​在 错误是:

Warning: require(../lib/GoogleChart.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/project1/admin/googlechart/examples/line_chart_full.php on line 3

Fatal error: require(): Failed opening required '../lib/GoogleChart.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/project1/admin/googlechart/examples/line_chart_full.php on line 3

可能是错误的,因为我已在目录

上完成了chmod -R 777

1 个答案:

答案 0 :(得分:0)

您可以尝试使用从文档根开始的绝对路径(如果您不需要在命令行中运行脚本,因为如果脚本是由shell启动的话,则不提供$ _SERVER数组)

 require($_SERVER['DOCUMENT_ROOT'] . "/lib/GoogleChart.php";

lib 目录放在根目录中(www.example.com/lib/GoogleChart.php)。

我建议使用 require_once

相关问题