Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How To Fix open_basedir restriction Error in WordPress on VPS or a Dedicated Ser  (Read 2091 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
If you are on a VPS or dedicated host with cPanel WebHost Manager (WHM), then to disable PHP open_basedir restriction in , go to Tweak Security > Security > Configure > PHP open_basedir Tweak, and disable it. You can also selectively enable or disable it for various user accounts.

If you are on a VPS or dedicated host with Plesk, go to Tools and Settings > Simple View Settings > PHP Settings. Here, enter custom value for the open_basedir option, to put {DOCROOT}\;\Windows\Temp\ as the value. Click OK and restart Plesk services.

Note that disabling the open_basedir restriction globally in Plesk will not work for domains already created in it. It will work only for the domains created after the change. To disable open_basedir restriction for current domains, each domain must be edited individually. Here’s the procedure:

Go to Domains > (the domain you want to modify) > Websites & Domains > Advanced Operations > Website Scripting and Security > PHP Settings. Here, enter custom value for the open_basedir option (its in common settings), to put {DOCROOT}\;\Windows\Temp\ as the value. Now, recycle the domain’s application pool which will automatically update the php.ino file created by Plesk.

If you don’t have either Cpanel WHM or Plesk on your VPS or dedicated hosting, you can simply edit the Apache configuration file to disable the PHP open_basedir restriction. To do this, open httpd.conf file, and find the line like this,

Code: [Select]
php_admin_value open_basedir some_value_here
Replace it with the following line,

Code: [Select]
php_admin_value open_basedir none
You need to make this change only under the virtual host for the domain user account on which you want to disable the open_basedir protection.

To allow the php scripts in any user account on your web server to access some specific directories outside their home directory, without disabling the open_basedir restriction completely, add code like below to the httpd.conf file.

Code: [Select]
php_admin_value open_basedir "/home/user_account/:/usr/local/lib/php:/tmp:/new_directory"
Add more directories as needed by simply separating them with a colon (:) on Unix and Linux server and with semicolon (;) on a Windows server.

Restart the Apache server after making any change to the httpd.conf file.

Important Security Note: In the directory list above, the directory name is a regular expression match prefix. So a rule of /dir/incl will also match /dir/includes. To make sure that it matches the specified directory exactly, add a trailing slash, like /dir/incl/.

Update: The directory name specified in open_basedir is no longer a prefix since PHP 5.2.16 and 5.3.4. Its considered a full directory name now.

You can now easily fix the open_basedir restriction Error in WordPress.