Page 1 of 1

Set Up root path constant

Posted: Wed Dec 14, 2011 4:17 pm
by leandrojunior7
Hello, I am studying the code of phpBB, virtually all of the files have this code at the beginning of the file, my question is as follows:

How the php know that PHPBB_ROOT_PATH refers to the root directory where the files and directories are on the forum.
It seems to me that is a constant set to root, but where is it defined?, for example I wanted to change the PHPBB_ROOT_PATH to PHPBB_HOME

Code: Select all


define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);



Re: Set Up root path constant

Posted: Thu Dec 15, 2011 1:40 am
by Christopher
Probably these files are included by one of the scripts accessed in URLs. That variable it probably in the configuration file.

Re: Set Up root path constant

Posted: Thu Dec 15, 2011 7:48 am
by leandrojunior7
The configuration file called config.php its blank. its weird.

Re: Set Up root path constant

Posted: Fri Dec 16, 2011 1:26 am
by Christopher
It sounds like the installation script was not able to write the config.php file. If you search for "phpBB configuration file" you can get information about how to fix this.

Re: Set Up root path constant

Posted: Fri Dec 16, 2011 6:17 am
by leandrojunior7
So, the conditional always returns false cause its not defined any constant called PHPBB_ROOT_PATH.

Code: Select all

<?
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
?>
Is it tha same thing following?

Code: Select all

<?
$phpbb_root_path = './';

?>


Re: Set Up root path constant

Posted: Fri Dec 16, 2011 11:53 pm
by Christopher
Yes.

Re: Set Up root path constant

Posted: Sat Dec 17, 2011 5:17 pm
by leandrojunior7
THANKS ! :)