PHP/MariaDB/MySQL

PHP open_basedir Restriction in Effect

Updated November 2026 14,140 views 3 min read
PHP/MariaDB/MySQL | Updated November 2026

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.

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
Tip

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 Ticket

Frequently 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

  1. Use your domain name - not the server hostname URL
  2. Check hardcoded paths - update any paths from a previous host
  3. Use relative or dynamic paths - $_SERVER['DOCUMENT_ROOT'] instead of absolute paths
  4. Session path - set to your account tmp directory if needed
  5. Contact support - if the path restriction needs adjusting

Last updated November 2026 · Browse all PHP/MariaDB/MySQL articles

Share: X in Reddit f Email
  • 483 Users Found This Useful

Was this answer helpful?

Related Articles

Server Paths - PHP Perl Python and More

PHP/MariaDB/MySQL | Updated November 2026 The default path to PHP on Ultra Web Hosting...

What Port is MariaDB/MySQL On?

PHP/MariaDB/MySQL | Updated September 2026 MariaDB/MySQL runs on port 3306 by default on...

Running a PHP file with a cron job

PHP/MySQL | Updated November 2026 You can schedule PHP scripts to run automatically at set...

How Do I Update or Change My PHP Version

Hosting Control Panel | Updated October 2026 Ultra Web Hosting runs CloudLinux with multiple...

Register Globals On Off

PHP/MySQL | Updated November 2026 register_globals was a PHP setting that automatically...



Save 30% on web hosting - Use coupon code Hosting30