php 本地值和主值有什么区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19520744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between local value and master value
提问by Liauchuk Ivan
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
?
当我显示时,phpinfo();
我看到两列: local value
和master value
。网络服务器local value
什么时候选择,什么时候选择master value
?
采纳答案by Marc B
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.
master
要么是编译到 PHP 中的值,要么是通过 mainphp.ini
指令设置的值。例如,当 PHP 启动时生效的值,在它执行您的任何代码之前。
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...
local
是在您调用 时当前有效的值phpinfo()
。此本地值是通过ini_set()
调用、php_value
httpd.conf/.htaccess 中的指令等进行的任何覆盖的 END 结果...
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
.
鉴于此,master
值为qux
,local
值为kittens
。
回答by Legionar
"Master Value" (from php.ini) could be overridden with "Local Value" in httpd.conf, .htaccessor other Apache configuration with php_valuedirective.
“主值”(来自 php.ini)可以在httpd.conf、.htaccess或其他带有php_value指令的Apache 配置中被“本地值”覆盖。
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.
第一个是局部值,第二个是全局值。本地值覆盖全局值并在 PHP、HTACCESS 等中设置,而全局值在 php.ini 中设置。要回答您的问题,将使用第一个值。
回答by Nittn Warshne
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).
托管网站将检查 . htaccess
或者.user.ini
首先(这些文件在您的本地网站文件夹中也可以说是本地级别的配置文件)。
Local values overrides Master values, so php will check the local values first.
本地值会覆盖主值,因此 php 将首先检查本地值。
master value set in php.ini
(main php configuration file)
run following commands in terminal to find the correct path
在php.ini
(主php配置文件)中设置的主值在终端中运行以下命令以找到正确的路径
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
所以即使我们在 中设置主值php.ini
,我们也需要检查本地值.htaccess
或.user.ini