PHP settings for a separate domain

good afternoon, how to make different php settings for different domains
in the vesta panel it was possible to place the php5-cgi.ini settings file in the cgi-bin folder

I need to remove the storage folder from the public_html directory
i need to setup open_basedir for one domain

/usr/local/hestia/web/data/templates/web/php-fpm/
path does not exist

https://www.php.net/manual/en/configuration.file.per-user.php
CMS(opencart) out of the box has a php.ini file in the root but it does not work

And why are the settings allowed for php 7.4 also applied to other versions?

Hestia docs …
Web domains and SSL Certicates — Hestia Control Panel documentation (hestiacp.com)

2 Likes

What means YOURNAME-PHP-X_Y.tpl
if username is demo then demo-PHP-7_4.tpl

what can I put inside, it doesn’t look like a php.ini file at all ?

[%domain%]
listen = /run/php/php%backend_version%-fpm-%domain%.sock
listen.owner = %user%
listen.group = www-data
listen.mode = 0660

user = %user%
group = %user%

pm = ondemand
pm.max_children = 8
pm.max_requests = 4000
pm.process_idle_timeout = 10s
pm.status_path = /status

php_admin_value[upload_tmp_dir] = /home/%user%/tmp
php_admin_value[session.save_path] = /home/%user%/tmp
php_admin_value[open_basedir] = /home/%user%/.composer:/home/%us…
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]%domain%

env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /home/%user%/tmp
env[TMPDIR] = /home/%user%/tmp
env[TEMP] = /home/%user%/tmp

No but you are allowed to set any php.ini setting via

php_admin_value[php_ini_setting]=‘setting_here’

I need separate settings for each user
now I’m fighting a warning: is_readable(): open_basedir restriction in effect. File
I’m trying to /home/$user/conf/web/apache2.conf
<Directory /home/user/web/domain.ru/public_html>
AllowOverride All
php_admin_value open_basedir /home/user/web/domain.ru/public_html:/home/user/web/domain.ru/directory
it throws an error
open_basedir = none does not work

demo-PHP-7_4.tpl
php_admin_value[open_basedir] = /home/%user%/.composer:/home/%us…

it is very sad that the control panel does not control and you need to fight it

at the moment I need to change the php settings (let’s say the size of the uploaded file) and add a directory ( Warning : is_readable(): open_basedir restriction in effect. File), can you explain to the stupid where and what
Sorry for my english

As told templates is the way to go:

; origin-src: deb/php-fpm/multiphp.tpl

[%domain%]
listen = /run/php/php%backend_version%-fpm-%domain%.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

user = %user%
group = %user%

pm = ondemand
pm.max_children = 8
pm.max_requests = 4000
pm.process_idle_timeout = 10s
pm.status_path = /status

php_admin_value[upload_tmp_dir] = /home/%user%/tmp
php_admin_value[session.save_path] = /home/%user%/tmp
php_admin_value[open_basedir] = /
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]%domain%

env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /home/%user%/tmp
env[TMPDIR] = /home/%user%/tmp
env[TEMP] = /home/%user%/tmp

Will allow php to run with out openbaar_dir in affect

Create a new template for example:
/usr/local/hestia/data/templates/web/php-fpm/nobase_PHP-8_0.tpl

Past the contents in the template…

Then change the backend template in Web settings or run

v-change-web-domain-backend-tpl user domain.com /nobase_PHP-8_0

If you make changes to a template you still need to load a diffferent template or rebuild the template!

It works for sure …

Created index.php with content:

<?php var_dump(file_get_contents('/home/user/.bashrc'));

Then http://domain.com/ and you should see the contents of .bashrc

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.