Disabling the open_basedir function

In case your site has problems with the open_basedir function when loading pages, you can disable it. This is indicated by the open_basedir restriction in effect error appearing on the server in the error logs or on the site pages

The idea of the open_basedir is to restrict a site's PHP scripts from accessing other directories and scripts hosted outside the site. The main purpose of this function is to isolate sites so that each of them allocates files or directories of its root directory without interfering with similar systems of other sites.

To disable the open_basedir feature in the Hestia panel, follow these steps:

1. Comment out the lines concerning the specified function in the template-config file. The location of the template files can be found at /usr/local/hestia/data/templates/web/php-fpm/ Their names are similar to PHP versions. For example, for version 7.4 there is a teimplate called PHP-7_4.tpl.

The php_admin_value[open_basedir] = line should be commented out. A semicolon character like ;php_admin_value[open_basedir] = ... is added to the beginning of the line.

You can do this in any file editor, such as vim or nano. The command sed -i 's/php_admin_value[open_basedir]/;php_admin_value[open_basedir]/g' /usr/local/hestia/data/templates/web/php-fpm/PHP-7_4.tpl' /usr/local/hestia/data/templates/web/php-fpm/PHP-7_4.tpl;

It is worth paying attention to the file name - it should correspond to the desired PHP version. The user should change the name as desired.

2. Make changes to the main site configuration and reload the PHP service. Actions are performed independently using the control panel or through the command v-change-web-domain-backend-tpl admin example.pp.ua PHP-7_4. In this line there are three variables: username, domain of the site and the name of the template - respectively admin, example.pp.ua, PHP-7_4.

At this line there are three variables: username, domain of the site and the name of the template - respectively admin, example.pp.ua, PHP-7_4.

The user should modify the given data according to their needs before running the command.

3. Verify that the function is disabled. This step is performed using the phphinfo script. Check that the function is disabled.