PHP open_basedir Restriction in Effect

PHP/MariaDB/MySQL | Updated March 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

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 March 2026 · Browse all PHP/MariaDB/MySQL articles

  • 483 Users Found This Useful

Was this answer helpful?

Related Articles

Learn About MySQL

Databases | Updated 2026 MariaDB (the MySQL-compatible database server on Ultra Web Hosting)...

PHP system exec Functions Disabled on Shared Hosting

PHP/MariaDB/MySQL | Updated March 2026 The error "Warning: system() has been disabled for...

What Port is MariaDB/MySQL On?

PHP/MariaDB/MySQL | Updated 2026 MariaDB/MySQL runs on port 3306 by default on all Ultra Web...

How do I backup a MariaDB - MySQL Database?

PHP/MySQL | Updated 2026 Backing up your database is essential before making changes to your...

Cannot Connect to MySQL on Port 3306

PHP/MariaDB/MySQL | Updated March 2026 If you're getting connection errors when trying to...



Save 30% on web hosting - Use coupon code Hosting30