open_basedir is a PHP security setting that confines file operations to specific folders, so a script on your site can’t read system files or other accounts’ files. The warning is genuinely helpful: it tells you both the rejected path and the allowed ones.
What the error means
Warning: file_exists(): open_basedir restriction in effect. File(/var/www/html/uploads/logo.png) is not within the allowed path(s): (/home/user:/tmp) in /home/user/public_html/inc/media.php on line 31
file_exists(): the function that tried to access the file.File(/var/www/html/uploads/logo.png): the rejected path.allowed path(s): (/home/user:/tmp): the allowed folders, separated by colons.
The rejected /var/www/html doesn’t even exist in your account; it’s a common path on other servers. That’s the classic pattern behind this error.
Common causes
- An old absolute path after a migration, such as
/home/olduser/public_htmlor/var/www/html, saved in settings. - Laravel’s config cache:
bootstrap/cache/config.phpstores full paths from when it was built, sometimes from your machine, likeC:\laragon\www\myapp. - WordPress plugin settings that store absolute paths (cache, backup and security plugins), or an old
auto_prepend_fileline in.user.ini. - A temp folder outside the allowed list, which can also trigger WordPress’s missing temporary folder error.
- Symlinks pointing outside your account.
- Code reading system files under
/etcor/usr/share.
How to fix it
- Read both paths in the message: rejected and allowed. The full text is in cPanel under Metrics › Errors or in the
error_logfile. - Search for the old path in the usual config files via Files › File Manager:
wp-config.php,.user.ini,.htaccess, Joomla’sconfiguration.phpand Laravel’s.env. With SSH:
grep -rn "/home/olduser" ~/public_html --include=*.php --include=.user.ini --include=.htaccess
- In Laravel, clear the config cache so it’s rebuilt with the new paths:
php artisan config:clear
php artisan config:cache
Without SSH, delete bootstrap/cache/config.php by hand.
4. In WordPress, open and re-save the settings of cache and backup plugins, or reinstall the plugin named in the message. Remove any auto_prepend_file line with an old path from .user.ini.
5. Write paths that don’t depend on the server:
// instead of '/var/www/html/uploads'
$uploadDir = __DIR__ . '/uploads';
// a temp folder inside your account
$tmpDir = dirname(__DIR__) . '/tmp';
- Don’t try to widen the restriction in code:
ini_set('open_basedir', ...)only accepts a narrower value. If you think a legitimate path should be allowed, ask support.
Prevention
- Avoid hard-coded absolute paths; use
__DIR__and framework helpers such as Laravel’sstorage_path(). - Don’t upload cache files generated on your computer to the server.
- After every migration, search config files for the old username and path; see the cPanel-to-cPanel migration guide.
On ArabyHost
Every account is isolated in CloudLinux CageFS, and your site’s files live under your home folder /home/USER, so keep every path inside it. The Araby AI assistant reads the error log and points to the file and old path behind the warning. If you’re moving a site from another host, see our free migration help.
FAQ
Can I turn off open_basedir from my code?
No. ini_set can tighten open_basedir at runtime but can't widen it to paths the server doesn't allow. The right fix is making your code use paths inside the allowed folders.
How do I see which folders are allowed?
The message lists them in brackets after "allowed path(s)", separated by colons. You can also see the open_basedir value on a phpinfo() page.
Why did this appear after moving a Laravel site?
bootstrap/cache/config.php stores absolute paths from the old server or your own machine. Delete it or run php artisan config:clear so it's rebuilt with the new paths.