How can the inclusion of a PHP file in a different directory be handled to avoid errors like "failed to open stream: No such file or directory"?

When including a PHP file from a different directory, you need to provide the correct path to the file in order to avoid errors like "failed to open stream: No such file or directory". One way to handle this is by using the `__DIR__` magic constant to get the absolute path to the current directory and then constructing the path to the included file relative to that. This ensures that the file is found regardless of the current working directory.

<?php
include __DIR__ . '/path/to/your/file.php';
?>