open_basedir function used to define the locations or paths from which PHP is allowed to access files using function like fopen() and gzopen(). If the file is outside of the location or paths defined by open_basedir, PHP will refuse to open and read it. You can also not 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.
The default open_basedir restrictions for shared Linux hosting accounts have no value. PHP scripts can access all directories within your hosting account.
Set open_basedir in Apache
You can set the open_basedir restriction in httpd.conf file like below.
php_admin_value open_basedir "/var/www/vhosts/httpdocs"
Set open_basedir globally
You can also set the open_basedir restriction globally editing php.ini file. Put the below line in php.ini fine.
open_basedir = /var/www/vhosts/httpdocs
Now restart the apache service to apply changes.
You can create a phpinfo page under your document root path to verify the open_basedir set or not.
# cd /var/www/html/ # vim phpinfo.php <?php phpinfo(); ?>
Save and closer file. Open your web browser and enter below URL and check the open_basedir value.