D
D
Denis2015-02-18 13:34:45
Nginx
Denis, 2015-02-18 13:34:45

Is it possible to change the priority of settings in php.ini?

Greetings! First, general info:
1. Centos 6.5
2. Nginx 1.6.2 (front-end) + Apache 2.2.15 (back-end)
3. PHP 5.4.33 - in CGI mode
4. ISPManager 4
The essence of the problem :
Each virtual host has its own user php.ini (in general, this is understandable), which by default describes two directives: sendmail_path and session.save_path. In the global php.ini ("/etc/php.ini"), I registered all the general necessary settings. However, these settings are not picked up. For example, I registered a list of functions for "disable_functions" in the general php.ini, restarted Apache and on any virtual host, the same exec () function will be executed without problems. If the directive is written in the user's php.ini file, then everything works as it should, but writing the same thing for all hosts manually is somehow not kosher.
How I decided at this stage : I
created a php.ini file in the "php.d" directory, where I registered all the necessary directives that apply to all hosts.
What I don't like :
The php.ini priority in the "php.d" directory has a higher priority than the user one. Yes, if you look at the same "disable_functions" directive, then this can be considered a plus, but to a greater extent - this is still a minus. For example, in the general settings, I will specify the time zone of Honduras. Then the user will no longer be able to change this zone in his php.ini.
What I would like to have ideally :
Actually, reverse priority. That is, if some directive is not registered in the user's php.ini, then it is picked up from the general php.ini, and if the directive is registered in the user, then it is she who takes effect.
I would be grateful if someone could suggest the best way to do this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-02-18
@ShamblerR

Actually, this is how it should work.
Your script should copy your main config when generating php.ini to the user.
And copy it with every change in the admin panel, plus impose on it, corny stupidly to the very bottom of its custom settings, in which case it will happen.
If you need to forcibly change the settings for everyone, then I wrote about this on the wiki a long time ago.

find . -name 'php.ini' -exec sed -i 's/log_errors = Off/log_errors = On/g' "{}" \;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question