What is the difference between local value and master value

社会主义新天地 提交于 2019-11-27 00:16:49

问题


When I display phpinfo(); i see two columns: local value and master value. When the web-server will choose local value and when it will choose master value?


回答1:


master is either the value compiled into PHP, or set via a main php.ini directive. e.g. The value that's in effect when PHP fires up, before it executes any of your code.

local is the value that's currently in effect at the moment you call phpinfo(). This local value is the END result of any overrides that have taken place via ini_set() calls, php_value directives in httpd.conf/.htaccess, etc...

e.g.

php.ini:     foo=bar
httpd.conf:  php_value foo baz
.htaccess:   php_value foo qux
ini_set:     ini_set('foo', 'kittens');

Given that, the master value is qux, and the local value is kittens.




回答2:


"Master Value" (from php.ini) could be overridden with "Local Value" in httpd.conf, .htaccess or other Apache configuration with php_value directive.

The first is the local value, the second is the global value. The local value overrides the global value and is set within PHP, HTACCESS, etc. whereas the global value is set within php.ini. To answer your question, the first value is used.




回答3:


hosted website will check local values in .htaccess or .user.ini first (These files are in your local website folder also can say local level configuration files).

Local values overrides Master values, so php will check the local values first.

master value set in php.ini (main php configuration file) run following commands in terminal to find the correct path

php -i | grep 'Configuration File'

or

php -i | grep php.ini

so even if we set master values in php.ini, we also need to check local values .htaccess or .user.ini



来源:https://stackoverflow.com/questions/19520744/what-is-the-difference-between-local-value-and-master-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!