How does PHP search for files when using relative paths in include statements?
When using relative paths in include statements, PHP searches for files based on the current working directory of the script. This can lead to issues if the script is being executed from a different directory than expected. To solve this, it is recommended to use absolute paths or adjust the include_path directive in php.ini to specify additional directories to search for files.
// Using absolute path
include __DIR__ . '/path/to/file.php';