无法包含其他文件夹中的文件

I have current directory structure htdocs/mvc2/ which includes app and public folders.

If i run bootstrap.php http://localhost/mvc2/app/core/bootstrap.php with require_once '../config/config.php' it's included, works fine.

If i try to include bootstrap.php in my http://localhost/mvc2/public/index.php I'm getting the following errors:

Warning: require_once(../config/config.php): failed to open stream: No such file or directory in C:\xampp\htdocs\mvc2\app\core\bootstrap.php on line 2

Fatal error: require_once(): Failed opening required '../config/config.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\mvc2\app\core\bootstrap.php on line 2

I can include bootstrap.php file in my index.php if i comment out all the includes in bootstrap.php file though:|.

Im using windows7 with xampp. I have tried changing php.ini file as suggested by others having the same problem to no avail. It's currently:

; UNIX: "/path1:/path2"
include_path=C:\xampp\php\PEAR
; Windows: "\path1;\path2"
;include_path = ".;C:\xampp\php\pear"

open

C:\xampp\htdocs\mvc2\app\core\bootstrap.php

and edit this line

require_once('../config/config.php')

give the full path of this file config.php

you can use $_SERVER['DOCUMENT_ROOT'].'/YOUR_INCLUDEABLE_FILE_NAME';

$_SERVER['DOCUMENT_ROOT'] is The document root directory under which the current script is executing, as defined in the server's configuration file.

your server will return C:\xampp\htdocs by using $_SERVER['DOCUMENT_ROOT'].

hard coding the full path works. Tried using $_SERVER['DOCUMENT_ROOT'].'/YOUR_INCLUDEABLE_FILE_NAME' in win10 the DOCUMENT_ROOT is showing "/" instead of "\". It fails.