[INFO] I get an "open_basedir restriction in effect" error in the PHP script. How can I fix it?


2016-11-16 13:22:41 UTC


2017-08-16 17:11:36 UTC


Was this article helpful?

Have more questions?

Submit a request

[INFO] I get an "open_basedir restriction in effect" error in the PHP script. How can I fix it?

Applicable to:

  • Plesk 10.x for Windows
  • Plesk for Linux
  • Plesk Onyx for Windows
  • Plesk 11.x for Windows
  • Plesk 12.0 for Windows
  • Plesk 12.5 for Windows


A domain is showing a " 404 file not found " error. The Apache error log on the domain generates the following:

    PHP Warning:  Unknown: open_basedir restriction in effect.


This error means that the PHP script is trying to access a folder for which access is not allowed. For security reasons, PHP options for domains hosted in Parallels Plesk Panel (Plesk) allow access to the /tmp and http(s)docs folders only by default. Restrictions are limited by the open_basedir PHP variable for each virtual host separately.


If you need to allow PHP scripts on a certain virtual host to access additional folders, set up an option 'open_basedir' for the virtual host with the new path value, splitting the folder names with colons as described below.

Warning : Doing so may put your server at risk of being compromised. Make sure you understand the consequences of this action before carrying it out.

For Parallels Plesk Panel 10.3 and later versions:

This can be done in the Plesk web interface, see this article:

213954425 : [Info] Customizing PHP settings for a particular domain in Plesk 10.3 and later versions

For Parallels Plesk Panel versions prior to 10.3:

This action can only be made by a user with root privileges on the domains’ vhost.conf or vhost_ssl.conf files (for SSL virtual host). For more information, read the article ' Including Directives into Configuration File of Web Server ' in the Parallels Plesk Panel documentation.

Once you have applied these changes, you should recreate Apache’s configuration files and restart the Apache service using the following command in the shell. If the vhost(_ssl).conf file is found, then it will be added automatically to the httpd.include file of the domain:

This command is for Plesk 10.x:

~# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

For versions 9.x and older use this command instead:

~# /usr/local/psa/admin/sbin/websrvmng -a -v

NOTE : If you do not run the command above, vhost.conf or vhost_ssl.conf will not be included in your Apache configuration and the changes will not take effect.


NOTE : HTTPD_VHOSTS_D needs to be replaced by a real path to the domain location, which may vary according to your OS and Parallels Plesk Panel version. You can look up the current value in the /etc/psa/psa.conf file. ADD_PATH needs to be replaced by a real path to the folder to which we are granting access.

Create HTTPD_VHOSTS_D/domain.com/conf/vhost.conf :

php_admin_value open_basedir HTTPD_VHOSTS_D/domain.com/httpdocs:/tmp:/ADD_PATH

Create HTTPD_VHOSTS_D/domain.com/conf/vhost_ssl.conf :

php_admin_value open_basedir HTTPD_VHOSTS_D/domain.com/httpsdocs:/tmp:/ADD_PATH

For subdomains, create the corresponding HTTPD_VHOSTS_D/domain.tld/subdomains/subdomain/conf/vhost.conf file:

php_admin_value open_basedir "HTTPD_VHOSTS_D/domain.com/subdomains/subdomain/httpdocs:/tmp:/ADD_PATH"

You can also can set up a global ' open_basedir ' for a specific location required in /etc/php.ini. For example:

open_basedir = "/tmp"
Have more questions? Submit a request
Please sign in to leave a comment.