0

It's an error in MyBB, after install I get this error from the index:

Warning: require_once(./global.php): failed to open stream: No such file or directory in C:\jws\htdocs\index.php on line 18

Fatal error: require_once(): Failed opening required './global.php' (include_path='.;C:\php\pear') in C:\jws\htdocs\index.php on line 18

Index code near top:

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

The file is there, I checked in the folder. I haven't changed anything in the files. I'm using PHP 5.6.4, and the index file is loaded from a require_once in another file. Here:

<?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';
?>
JavaProphet
  • 931
  • 14
  • 29

3 Answers3

1

replace your index code with this

require_once 'global.php';
require_once MYBB_ROOT.'inc/functions_forumlist.php';
require_once MYBB_ROOT.'inc/class_parser.php';
sanoj lawrence
  • 951
  • 5
  • 29
  • 69
1

I managed to use:

chdir("the path");

to change the working directory, and I also had issues with redirection failure in the server.

Thanks for the help!

Rizier123
  • 58,877
  • 16
  • 101
  • 156
JavaProphet
  • 931
  • 14
  • 29
  • you are not supposed to answer answer your own question – sanoj lawrence Dec 30 '14 at 20:48
  • 4
    @sanojlawrence Yes he is/can! If he figured it out himself he can share his solution to other people with the same problem! Also can he accept his own answer! – Rizier123 Dec 30 '14 at 20:50
  • @Rizier123 if he can answer his own question then whats use of asking question – sanoj lawrence Dec 30 '14 at 20:54
  • 3
    @sanojlawrence To share the solution! (Also take a look here, this guy solved his problem and answered it after 2 years! http://stackoverflow.com/q/9260717/3933332) Also you may want to read the Help Center:http://stackoverflow.com/help/self-answer – Rizier123 Dec 30 '14 at 20:56
0

index.php code near top:

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

indexTest.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';
?>
Buse Gönen
  • 238
  • 1
  • 5