The directory (/home/XYZ/commn_folder_x) is not setup properly when using open_basedir

Using open_basedir parameters to include a Custom Folder…

My scenario:
All has been working well till I switched from Vesta to Hesta.

How was it working?
I edited/created templates accordingly and in particlular EDITED the open_basedir parameter to include the path to the Custom Folder.

I have tried doing the same here at Hestia to no avail.

Here is my setup:
I have 3 domains, A, B, C under user account XYZ. these three domains share a comon folder (commn_folder_x) that resides at /home/XYZ/commn_folder_x.

I have created custom templates under /usr/local/hestia/data/templates/web/php-fpm.
So i have default1.tpl and PHP7_4_custom.tpl
and added this at the open_dir directive:
php_admin_value[open_basedir] = /home/%user%/.composer:/home/%user%/web/%domain%/public_html:/home/%user%/web/%domain%/private:/home/%user%/web/%domain%/public_shtml:/home/%user%/tmp:/home/%user%/commn_folder_x:/tmp:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt

Note the added “commn_folder_x” within the parameters.
Went ahead rebuild, updated it via the Control panel to use the custom templates.

In my apllication, if i use $var_custom_path = “/home/XYZ/tmp/:” it works fine.
If i change it to $var_custom_path = “/home/XYZ/commn_folder_x” I get the error The directory (/home/XYZ/commn_folder_x) is not setup properly

What could be wrong?

If you want to create a custom template for php-fpm, the format is this:

whatever-PHP-7_4.tpl so in your case it would be custom-PHP-7_4.tpl if you don’t use that structure on the template name, Hestia will restart the default php-fpm service instead of php-7.4 so your changes are not bein applied.

I don’t know whether that is the root cause but it is worth to try it.

I have renamed accordingly to custom-PHP-7_4.tpl.

Then this part as is:
php_admin_value[open_basedir] = /home/%user%/.composer:/home/%user%/web/%domain%/public_html:/home/%user%/web/%domain%/private:/home/%user%/web/%domain%/public_shtml:/home/%user%/tmp:/home/%user%/commn_folder_x:/tmp:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt.

Then went ahead and selected as follows::
Web Template APACHE2 - default
Backend Template PHP-FPM - custom-PHP-7_4.tpl
Proxy Template - default.

Still getting The directory (/home/XYZ/commn_folder_x/) is not setup properly

What are the perms of that dir?

ls -ld /home/XYZ/commn_folder_x/

It says
drwxr-xr-x 2 www-data www-data 987136

If I set /home/XYZ/tmp/) it runs perfectly.
But I want to avoid using the folder tmp.

How its not working for me here at Hestia baffles me yet it was woring fine with Vesta. What could be the issue?

Change the owner to your user:

chown -R YourUser /home/XYZ/commn_folder_x/

Also, to check whether the changes to open_basedir are applied you can create a php file like openbasedir.php with the following content:

<?php echo ini_get('open_basedir'); ?>

Browse that file and check if the folder is in the output.

This has done it!
Working like a charm!
Thanks so much @sahsanu :wave: :wave:

1 Like