PHP 找不到require_once的文件,但它在那里?



这是MyBB中的一个错误,安装后我从索引中收到此错误:

Warning: require_once(./global.php): failed to open stream: No such file or directory in C:jwshtdocsindex.php on line 18
Fatal error: require_once(): Failed opening required './global.php' (include_path='.;C:phppear') in C:jwshtdocsindex.php on line 18

顶部附近的索引代码:

require_once './global.php';
require_once MYBB_ROOT.'inc/functions_forumlist.php';
require_once MYBB_ROOT.'inc/class_parser.php';

文件在那里,我签入了文件夹。我没有更改文件中的任何内容。我使用的是 PHP 5.6.4,索引文件是从另一个文件中的require_once加载的。这里:

<?php
$_SERVER = array(
"SERVER_PROTOCOL" => "HTTP/1.1","DOCUMENT_ROOT" => "C:/jws/htdocs","REMOTE_ADDR" => "127.0.0.1","REQUEST_URI" => "/","SERVER_SOFTWARE" => "JWS/1.0","argv" => "","REQUEST_TIME" => "Tue, 30 Dec 2014 12:33:14 PST","PHP_SELF" => "/","REMOTE_PORT" => "56601","REQUEST_METHOD" => "GET","SCRIPT_NAME" => "","SERVER_NAME" => "JWS/1.0","PATH_INFO" => "","ORIG_PATH_INFO" => "","argc" => "","GATEWAY_INTERFACE" => "N/I","SERVER_PORT" => "80","SCRIPT_FILENAME" => "C:/jws/htdocs/index.php","HTTP_ACCEPT_LANGUAGE" => "en-US,en;q=0.5","HTTP_HOST" => "127.0.0.1","QUERY_STRING" => "","REQUEST_TIME_FLOAT" => "1419971594194","HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0","HTTP_ACCEPT_ENCODING" => "gzip, deflate","SERVER_ADDR" => "127.0.0.1","HTTP_CONNECTION" => "keep-alive",
);
$_GET = array(
);
$_POST = array(
);
$_COOKIE = array(
);
$_REQUEST = array(
);
require_once 'C:/jws/htdocs/index.php';
?>

这个替换你的索引代码

require_once 'global.php';
require_once MYBB_ROOT.'inc/functions_forumlist.php';
require_once MYBB_ROOT.'inc/class_parser.php';

我设法使用:

chdir("the path");

更改工作目录,并且我还遇到了服务器重定向失败的问题。

感谢您的帮助!

索引.php顶部附近的代码:

<?PHP
require_once MYBB_ROOT.'/global.php';
require_once MYBB_ROOT.'/inc/functions_forumlist.php';
require_once MYBB_ROOT.'/inc/class_parser.php';
?>

索引测试.php

<?php
define("MYBB_ROOT", __DIR__);
$_SERVER = array(
"SERVER_PROTOCOL" => "HTTP/1.1","DOCUMENT_ROOT" => "C:/jws/htdocs","REMOTE_ADDR" => "127.0.0.1","REQUEST_URI" => "/","SERVER_SOFTWARE" => "JWS/1.0","argv" => "","REQUEST_TIME" => "Tue, 30 Dec 2014 12:33:14 PST","PHP_SELF" => "/","REMOTE_PORT" => "56601","REQUEST_METHOD" => "GET","SCRIPT_NAME" => "","SERVER_NAME" => "JWS/1.0","PATH_INFO" => "","ORIG_PATH_INFO" => "","argc" => "","GATEWAY_INTERFACE" => "N/I","SERVER_PORT" => "80","SCRIPT_FILENAME" => "C:/jws/htdocs/index.php","HTTP_ACCEPT_LANGUAGE" => "en-US,en;q=0.5","HTTP_HOST" => "127.0.0.1","QUERY_STRING" => "","REQUEST_TIME_FLOAT" => "1419971594194","HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0","HTTP_ACCEPT_ENCODING" => "gzip, deflate","SERVER_ADDR" => "127.0.0.1","HTTP_CONNECTION" => "keep-alive",
);
$_GET = array(
);
$_POST = array(
);
$_COOKIE = array(
);
$_REQUEST = array(
);
require_once MYBB_ROOT.'/index.php';
?>

相关内容

  • 没有找到相关文章

最新更新