Manage PHP Memory settings via template

Good Morning,

Is it possible to manage php memory settings via a template?

If yes how does one go about defining it in the tpl file?

I am asking as I would like to reduce the global memory settings for php but manage it depending on the application.

Yes,

php_value[memory_limit] = 256M

1 Like

Thanks @eris will try this out.

I have another question is it possible to define the following in a template file

error_reporting E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT NOT RECOMMENDED
log_errors Off On
short_open_tag Off On

Probally yes haven’t tested it…

php_value[log_errors] = On

Should work fine

what about the short_open_tag?

Is there a list of these variables for the templates somewhere by any chance?

For everything it should be the same… …

php_value[option_to_change] = Value

If you really want to do it server-wide, you might look at changing it in /etc/php/x.x/fpm/php.ini

I dont want to do it server wide.

You can find everything you need here : PHP: List of php.ini directives - Manual

You can see where you can adjust the setting and all the setting that exist.
If you want to do it server side you can edit the global php.ini
If you want to edit only for a website, the best way to do it is through a file .user.ini in the docroot.

You can change it with php-fpm pool too with the template.
Then as say Eris you have to use php_value =

If you want to reduce the global memory you can maybe try to use opcache_file_cache_only.
But be sure to do some cleanup in the cache frequently.
Take care about the different setting, this can cause some trouble…

1 Like

I have added this line to the template file but it seems like its being ignored as I have set it to 1024M but it looks at the global directive it seems from the server itself. I am not sure if I have done something wrong or this is the app itself?

Any suggestions on this is this anythign to do with Hestia at this point, or is this something I need to ask Invoice Ninja?

Evening any updates or suggestions on this as to why the template is not being used.