The open_basedir restriction in effect warning is a PHP security feature that prevents scripts from accessing files outside your account directory. It protects you and other users on the server from unauthorized file access. This guide explains why it happens and how to fix it.
Accessing Your Site via Server Hostname
This error most often occurs when you access your site using the server URL (https://serverXX.ultrawebhosting.com/~username) instead of your domain name. Access your site via your actual domain name and the error typically resolves.
01. What This Error Means
The open_basedir directive restricts PHP to only access files within your account's directory tree (/home/yourusername/). If a PHP script tries to read, write, or include a file outside this path, PHP blocks it and shows this warning.
This is a security feature, not a bug. On shared hosting, it prevents one account from accessing another account's files.
02. Common Causes and Fixes
Using the Server Hostname URL
If you're accessing your site via https://serverXX.ultrawebhosting.com/~username, switch to using your actual domain name. The server hostname URL can trigger path mismatches that cause this error.
Hardcoded Absolute Paths
If your script has a hardcoded path like /var/www/html/ or /home/oldusername/ from a previous host, update it to your current account path. Find your home directory path in cPanel > Server Information, or use PHP's $_SERVER['DOCUMENT_ROOT'] for portable paths.
Plugin or Theme Accessing Outside Paths
WordPress plugins or themes sometimes attempt to access /tmp/ or other system directories directly. Your account has its own /home/yourusername/tmp/ directory. If a plugin hardcodes /tmp/, it may need a configuration update or the developer may need to fix the path.
Session Save Path
If the error references session files, your PHP session save path may point outside your home directory. You can set it in .htaccess:
php_value session.save_path /home/yourusername/tmp
To see your current open_basedir setting, check your phpinfo output. Create a file with <?php phpinfo(); ?> and search for "open_basedir" in the output. Delete the file when done.
Still Getting This Error?
If you've checked the paths and the error persists, open a ticket with the full error message. We can check the server-side configuration and adjust the open_basedir path for your account if needed.
Open a Support TicketFrequently Asked Questions
What does open_basedir restriction in effect mean?
It is a PHP security feature that stops scripts from accessing files outside your account directory. On shared hosting it protects you and other users from unauthorized file access. The warning appears when a script tries to read or include a file outside the allowed path.
How do I fix an open_basedir error?
Keep the files your script accesses inside your own account directory and use paths within it rather than absolute system paths like /tmp or another user's home. If a legitimate include points outside your account, move the file into your account or adjust the script to a local path.
Why does my script work on another host but not here?
Other hosts may not enforce open_basedir, so a script that reaches outside its own directory runs there but is blocked here. The fix is to make the script self-contained within your account, which is also the more secure and portable approach.
Can open_basedir be disabled?
It is a shared-hosting security control and is not disabled on shared accounts, since it protects everyone on the server. The correct fix is to keep file access within your account. If your application genuinely needs broader access, that points to a VPS or dedicated server.
Quick Recap
- Use your domain name - not the server hostname URL
- Check hardcoded paths - update any paths from a previous host
- Use relative or dynamic paths -
$_SERVER['DOCUMENT_ROOT']instead of absolute paths - Session path - set to your account tmp directory if needed
- Contact support - if the path restriction needs adjusting
Last updated November 2026 · Browse all PHP/MariaDB/MySQL articles
