Warning: file_exists(): open_basedir restriction in effect. File(/x) is not within the allowed path(s)
PHP is configured to access only certain directories, and the script tried to touch a file outside them.
Seen on:
PHP
Meaning
Shared hosts set open_basedir to your account directory. Paths outside it — /tmp, another site’s folder, or absolute paths copied from a different server — are blocked.
Common causes
- Absolute path from another server/environment
- Temp/upload directory outside the allowed paths
- Symlinks pointing outside the allowed tree
⚡ Quick fix
- Use paths inside your account (e.g.
__DIR__-relative) - Set
upload_tmp_dir/sys_get_temp_dir()to a directory inside the allowed paths - Ask the host or adjust open_basedir in the PHP selector
Detailed fix by platform
PHP
- Check the current value with
ini_get('open_basedir')
How to diagnose
- Allowed — Which paths are allowed (in the message)?
- Requested — Which path did you use?
🧠 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