MyBB Community Forums

Full Version: Wierd Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
My forums are at the /forums directory.

My index.php file has this code:

<?php
define("IN_MYBB", 1);
require 'forums/global.php';

if($mybb->user['uid'] != 0)
{
echo "Hello, you are logged in! " . $mybb->user['username'] . "";
}


?>

And it gives me a really wierd error.
It says this:

Quote:Warning: main(./inc/init.php) [function.main]: failed to open stream: No such file or directory in /home/warp/public_html/forums/global.php on line 13

Fatal error: main() [function.require]: Failed opening required './inc/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/warp/public_html/forums/global.php on line 13

What is wrong?
Why can't it open init.php?

NOTE: index.php with the code is NOT inside the /forums directory! It is outside of the directory. Although, the wierd thing is that I made it have the right directory forums/global.php
change require 'forums/global.php'; to require dirname(__FILE__).'/forums/global.php';

Does that work?
Unfortunately, no, that does not work.
Can you try again, or somebody else help?
Oh, and what I'm basically trying to do is make my index.php tell members of the forum who are logged in say "You are logged in (the persons username on the forum)" without getting that wierd error.
in forums/global.php find:

require_once "./inc/init.php";

and replace with:

require_once dirname(__FILE__)."/inc/init.php";
Tikitiki,

I think all code within MyBB's core should either use absolute includes / requires or prepend them with the $MYBB_ROOT variable. As it stands, you must change directories to your MyBB installation before calling require or include.
do you see MYBB_ROOT defined anywhere before the init include?

I don't know why dirname(__FILE__) got removed from 1.2.3 as all it seems to be doing is causing more errors.
I tried tikitikis method, and no, it did not work.

I guess this means 1 less mybboard user.
I need to find a board that is efficient, powerful, and can allow integration on my website. It's very sad that I can't even welcome a visitor off of the forum.
Are you sure it didn't work? You tried this, right? http://community.mybboard.net/showthread...#pid108712

Please don't give up yet, there's always a solution it just takes time. There's no need to jump to conclusions. You will always have problems with every forum software. It's just which problems do you wish to choose to deal with.
Tikitiki Wrote:in forums/global.php find:

require_once "./inc/init.php";

and replace with:

require_once dirname(__FILE__)."/inc/init.php";

Ok I was getting this area, and when I did this, now I get
Warning: Cannot modify header information - headers already sent by (output started at /home/aiwanei/public_html/taguild/header.php:13) in /home/aiwanei/public_html/taguild/bb/inc/functions.php on line 1118
Pages: 1 2 3