What are the potential pitfalls of using relative paths in PHP, especially when dealing with safe mode restrictions?

When using relative paths in PHP, especially when dealing with safe mode restrictions, there is a risk of encountering errors due to the server's configuration. To avoid potential pitfalls, it is recommended to use absolute paths instead of relative paths to ensure that the file paths are correctly resolved regardless of the server settings.

// Using absolute path to include a file
include $_SERVER['DOCUMENT_ROOT'] . '/path/to/file.php';