Linux Plesk PHP error: open_basedir restriction in effect

What is open_basedir ?

The open_basedir function defines the locations or paths from which PHP is allowed to access files using functions like fopen() , gzopen() , etc. If a file is outside of the paths defined by open_basdir setting, PHP will refuse to open it. You can’t use a symbolic link as a workaround, because the path that the symbolic link resolves to falls under the restrictions of the open_basedir function.

Note: The open_basedir restrictions can be turned off in the Apache configuration file e.g. httpd.conf, with the following lines:

<IfModule sapi_apache2.c>
php_admin_value open_basedir none
</IfModule>

If you have problems with Plesk control panel with virtual hosts on Linux servers if PHP error occured: open_basedir restriction in effect
you can create custom configuration file for virtual host to change default php_admin_value open_basedir value as shown in example below:

# more /var/www/vhosts/shkodenko.com/conf/vhost.conf 

<Directory /var/www/vhosts/shkodenko.com/httpdocs>
<IfModule sapi_apache2.c>
# php_admin_value open_basedir none
php_admin_value open_basedir “/var/www/vhosts/shkodenko.com/application:/var/www/vhosts/shkodenko.com/cache:/var/www/vhosts/shkodenko.com/httpdocs:/var/www/vhosts/shkodenko.com/library:/var/www/vhosts/shkodenko.com/tests”
</IfModule>
<IfModule mod_php5.c>
# php_admin_value open_basedir none
php_admin_value open_basedir “/var/www/vhosts/shkodenko.com/application:/var/www/vhosts/shkodenko.com/cache:/var/www/vhosts/shkodenko.com/httpdocs:/var/www/vhosts/shkodenko.com/library:/var/www/vhosts/shkodenko.com/tests”
</IfModule>
</Directory>
#

To check web server Apache configuration run command:

# /sbin/service httpd configtest

To add your custom virtual host configuration file /var/www/vhosts/shkodenko.com/conf/vhost.conf run command:

# /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain shkodenko.com

To check if web server Apache configuration is OK run:

# /sbin/service httpd configtest

To restart web server Apache run:

# /sbin/service httpd graceful