What are the potential pitfalls of using include_path in PHP, and how can they be avoided?

Using include_path in PHP can lead to security vulnerabilities such as directory traversal attacks if not properly configured. To avoid this, it is recommended to specify absolute paths or use the __DIR__ constant to ensure that included files are only loaded from specific directories.

// Avoid using include_path and specify absolute paths or use __DIR__ constant instead
include __DIR__ . '/path/to/file.php';