PHPology is a collective of highly skilled, award winning, web gurus.
Contact Raj on 07985 467 213 or email info@phpology.co.uk

Disable open_basedir in Plesk

From time to time there will be a situation where you would need to disable open_basedir if you are hosting with Plesk.

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() and gzopen(). If a file is outside of the paths defined by open_basdir, PHP will refuse to open it. You cannot 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.

Below are the steps I use to complete that task:

Create a new file, called vhost.conf
This file will include anything you want to disable from httpd.conf main config from your virtual host.

1.# touch /var/www/vhosts/yourdomain.com/conf/vhost.conf

Now we edit the file and we add the following,
1.# vi /var/www/vhosts/yourdomain.com/conf/vhost.conf

<Directory /var/www/vhosts/yourdomain.com/httpdocs>
php_admin_value open_basedir none
</Directory>

Once you finish adding the mentioned lines, its time to reconfigure and restart the webserver config.
1.# /usr/local/psa/admin/sbin/websrvmng -v -a

open_basedir for yourdomain.com should be disabled by now.