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.
Failed to open streamfailed opening requiredNo such file or directory 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 not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in PHP
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 12 Oct 2026