Valentina is right on all accounts, but it sounds like the best option for you is the last one noted in her response which is using $_SERVER['DOCUMENT_ROOT'].
The code you'd be writing would look something like this:
include $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
Also, there's a 3rd option (4th if you consider turning allow_url_fopen ON an option, but I don't). Although I'm not privy to using this function for this purpose and I can see why Valentina omitted it, you can use file_get_contents(). If you echo the code using file_get_contents, you can use the various functions in those includes, but this doesn't always come out as planned. Anyway, you're allowed to use absolute paths in file_get_contents(), but it might be wise to just come up with a function above all your includes and use it to make the correct relative path.
Here's the function I wrote:
function myInclude($absolute_path){
// Check HTTP_HOST
if (isset($_SERVER['HTTP_HOST'])){
$_SERVER['HTTP_HOST'] = strtolower($_SERVER['HTTP_HOST']);
if(!preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $_SERVER['HTTP_HOST'])){
header('HTTP/1.1 400 Bad Request');
exit;
}
} else { $_SERVER['HTTP_HOST'] = ''; }
$target_array = explode('/', $absolute_path);
$host = explode('/', $_SERVER['HTTP_HOST']);
$current_directory_array = explode('/', $_SERVER['SCRIPT_NAME']);
array_shift($current_directory_array); // remove empty item
// chop the base url & host name off the absolute path
for($i = 0; $i < count($target_array); $i++){
if($target_array[$i] == $_SERVER['HTTP_HOST']){
$target_path_array = array_slice($target_array, -(count($target_array)-($i+1)));
}
}
if(!$target_path_array){ $target_path_array = $target_array; }
// pop off all the same directories
$length = (count($current_directory_array) > count($target_path_array) ? count($current_directory_array) : count($target_path_array));
for($i = 0; $i < $length; $i++){
if($current_directory_array[$i] == $target_path_array[$i]){
array_shift($current_directory_array);
array_shift($target_path_array);
} else {
array_shift($current_directory_array);
array_shift($target_path_array);
break;
}
}
// any remaining parts of the current scripts path, change to ../
for($i = 1; $i < count($current_directory_array); $i++){ $relative_path .= '../'; }
$relative_path .= implode('/', $target_path_array);
return include($relative_path);
}
So long as you put this function above any of your includes on the landing page, it will work on any nested included file... assuming you don't visit the included file directly.
Also, keep in mind that the HTTP_HOST variable is user input (which is why it's checked), so if this is changed then the function might fail.
However, the function does allow you to omit the host entirely.