What are the potential pitfalls of using relative paths in include commands in PHP?

Using relative paths in include commands in PHP can lead to issues when the script is executed from different directories, as the path may not resolve correctly. To avoid this problem, it is recommended to use absolute paths instead of relative paths in include commands.

// Use absolute path instead of relative path in include command
include(__DIR__ . '/path/to/file.php');