Skip to content 99% OFF 🎉 Anniversary Sale 99% OFF Shared Hosting Use Code HURRYUP Claim Offer 99% OFF Hosting
99% OFF Hosting — Code HURRYUP
Products
AI Website Builder New VPS Hosting Cloud Servers Web Hosting Dedicated Servers Domains
Company
About Documentation Support Center Contact Get Started Call +91 75795 45488
Login
Hosting Panel — cPanel & Billing Console Panel — VPS Management
ALL SYSTEMS OPERATIONAL
Troubleshooting

Fix 'open_basedir Restriction in Effect' in cPanel & WordPress

Getwebup 5 min read

You update a plugin, move a site, or add a symlink, and suddenly PHP throws a wall of warnings: open_basedir restriction in effect. File(/home/otheraccount/public_html/wp-content/...) is not within the allowed path(s). The site half-loads, images break, or a backup plugin just stops. Here's what's actually happening and how to fix it without turning the restriction off entirely.

What open_basedir actually does

open_basedir is a PHP setting that fences off which directories a PHP script is allowed to touch. On shared hosting it's normally set to your account's home directory only, something like:

open_basedir = /home/username/:/tmp/:/usr/lib/php/

That's a deliberate security boundary. If PHP could read and write anywhere on the server, one compromised or buggy script on any account could read another customer's wp-config.php. The restriction exists so a hack on one site can't walk sideways into the next one. It's not a bug — but it does break specific, legitimate use cases.

Symptom: the exact error you'll see

It usually shows up as a PHP warning, not a hard crash, so the page half-renders:

Warning: file_get_contents(): open_basedir restriction in effect.
File(/home/siteb/public_html/uploads/logo.png) is not within the allowed path(s):
(/home/sitea/:/tmp/:/usr/lib/php/) in /home/sitea/public_html/wp-content/plugins/example/functions.php on line 42

The path in the error tells you exactly which file PHP tried to reach and which directory it's actually confined to. That's your first diagnostic clue — don't skip reading it.

The usual culprits

  • Symlinked or mapped directories. A staging site, a shared uploads folder, or a manually created symlink that points outside your account's home directory. PHP follows the link but open_basedir blocks the read.
  • Backup and migration plugins. UpdraftPlus, Duplicator, and similar tools sometimes try to scan sibling directories or a custom backup destination outside public_html.
  • WordPress Multisite with domain mapping where subsites' files were placed outside the primary account's docroot instead of under it.
  • Addon domains pointed at a folder outside the main account — rare, but it happens after a manual DNS/document-root change in WHM.
  • A recent migration where wp-config.php or an include still references the old account's absolute path (e.g. /home/oldaccount/...) instead of the new one.

Fix it on shared cPanel hosting

You can't edit php.ini directly on shared hosting, but you have two tools that matter here:

  1. Check the current setting. In cPanel, go to Software > MultiPHP INI Editor, select your domain, and look for the open_basedir line under Editor Mode. This shows you exactly what path PHP is locked to right now.
  2. Fix the actual reference, don't widen the fence. In almost every shared-hosting case, the real fix is to stop the script from reaching outside your account rather than expanding open_basedir. Move the file it's trying to reach into your own public_html or a subfolder of your home directory, and update the plugin's saved path setting to match.
  3. If you genuinely need a wider path (for example, a legitimate cross-account setup your host approved), open a support ticket. Most hosts, including Getwebup, can add a specific extra path to your account's open_basedir value — they won't disable it outright, since that reopens the exact isolation risk it exists to prevent.

Fix it on a VPS you manage yourself

On a VPS you have full control, so you can edit the setting directly — but do it narrowly, not by removing it.

For PHP-FPM (most current LEMP/LiteSpeed setups), edit the pool config for that site, typically at:

/etc/php/8.3/fpm/pool.d/yoursite.conf

Find or add the line:

php_admin_value[open_basedir] = /var/www/yoursite/:/tmp/:/usr/lib/php/

To add an extra allowed path (say, a shared uploads directory used by two related sites), append it with a colon:

php_admin_value[open_basedir] = /var/www/yoursite/:/var/www/shared-uploads/:/tmp/:/usr/lib/php/

Then reload PHP-FPM:

sudo systemctl reload php8.3-fpm

For Apache with mod_php, the same directive can live in the vhost file instead:

php_admin_value open_basedir "/var/www/yoursite/:/tmp/:/usr/lib/php/"

followed by sudo systemctl reload apache2. Always test with a quick <?php phpinfo(); ?> page (delete it right after) to confirm the new value actually took effect — a typo in the pool file silently falls back to the previous restriction rather than erroring out.

Prevention

SituationWhat to do instead of disabling open_basedir
Migrating a site to a new accountSearch wp-config.php and any custom includes for hardcoded old paths like /home/oldaccount/ and update them
Backup plugin needs an external destinationPoint it at cloud storage (S3-compatible, Google Drive) instead of a local sibling folder
Two sites need to share uploaded filesSync via a cron job or rsync instead of a cross-account symlink
Multisite with mapped domainsKeep every mapped site's files inside the same account's home directory tree

If you're still stuck after checking the path in the error message against MultiPHP INI Editor (or your pool config on a VPS), it's worth pasting the exact warning into a support ticket — the path in the message almost always points straight at the misconfigured plugin setting or leftover migration reference.

Frequently asked questions

Can I just disable open_basedir instead of fixing the path?

You can, but you shouldn't on shared hosting, and most hosts won't do it for you — it removes the isolation between your account and every other account on the server. On a VPS you control, disabling it is possible by removing the directive, but it's safer to just widen the allowed path list to include exactly what you need.

Why did this error appear suddenly with no changes on my end?

A host-side PHP update or a plugin auto-update is the most common cause. Newer PHP versions and plugin releases sometimes change default paths or add file checks that weren't there before, tripping a restriction that was always in place but never triggered.

Does open_basedir affect database connections?

No. It only restricts filesystem access (file_get_contents, include, fopen, and similar functions). A MySQL connection error with a similar-looking warning is a separate issue, usually wrong credentials or a database host mismatch.

How do I find the current open_basedir value without triggering the error again?

In cPanel, use Software > MultiPHP INI Editor and switch to Editor Mode for your domain — it lists the live value without running any code. On a VPS, grep your PHP-FPM pool file or run php -i | grep open_basedir from the command line.

Will fixing this break my site further?

No — you're not removing a restriction, you're pointing PHP at the correct location or adding one specific extra path. As long as the path you add is accurate, nothing else about PHP's behavior changes.

#open_basedir #php-ini #cpanel #wordpress #php-configuration

Keep reading

Chat with Support