How can PHP include files be set to access the root folder?

When including files in PHP, the path is relative to the current file location by default. To access files from the root folder, you can use the $_SERVER['DOCUMENT_ROOT'] superglobal variable to get the absolute path to the root directory. By concatenating this with the file path you want to include, you can ensure that the file is accessed from the root folder.

<?php
include $_SERVER['DOCUMENT_ROOT'] . '/path/to/file.php';
?>