What best practices should be followed when including files in PHP scripts to avoid errors like "failed to open stream"?

When including files in PHP scripts, it is important to use the correct file path to avoid errors like "failed to open stream". To ensure that the file is included properly, it is recommended to use the `__DIR__` constant to get the absolute path of the current script directory and then concatenate it with the relative path of the file to be included.

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