What are the potential pitfalls of using relative paths for file inclusions in PHP?

Using relative paths for file inclusions in PHP can lead to errors if the file structure changes or if the script is executed from a different directory. To avoid this issue, it's recommended to use absolute paths or define a base path variable to ensure consistent file inclusions.

// Define base path
define('BASE_PATH', __DIR__);

// Include file using absolute path
include BASE_PATH . '/path/to/file.php';