Warning: include(x.php): Failed to open stream: No such file or directory
PHP couldn’t open a file for include/require/fopen — wrong path, missing file, or no permission.
Seen on:
PHP
Meaning
Relative paths are resolved from the current working directory and include_path, not from the file that does the include. Using __DIR__ makes paths reliable. “Permission denied” instead of “No such file” means the web server user can’t read it.
Common causes
- Relative path resolved from a different working directory
- File missing on the server (not uploaded, case mismatch)
- Web server user lacks read permission
- open_basedir restriction
⚡ Quick fix
- Build paths with
__DIR__ . '/file.php' - Check the exact path and file name case
- Fix permissions (644 files, 755 dirs)
- Check open_basedir in php.ini
Detailed fix by platform
PHP
require_once __DIR__ . '/../includes/config.php';
How to diagnose
- Path — Exact path in the message — does it exist?
- Case — Linux is case-sensitive
- Permissions — Readable by the web server user?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026