I think the answer is that when called, global.php is in turn calling other files. If you look in the global.php file, you'll see when it is including other files, it references them by a relative path, like this:
require_once(DIR . "/includes/functions.php");
So, when your script is including global.php from the root directory, the global.php is trying to include /includes/functions.php, but the file is actually located in /forum/includes/functions.php. Using chdir allows you to change the working directory so that the above statement will work. The reason you are seeing the oddball message about the php and pear directories is that it tried to look for the include file in the working directory and then tried to find it in the directories that have global scope to PHP.
I hope that wasn't too confusing in the way I explained it.
|