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

- 30,738
- 21
- 105
- 131

- 1,913
- 2
- 13
- 22
4 Answers
master
is either the value compiled into PHP, or set via a main php.ini
directive. I.e., 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.
For example,
php.ini: foo=bar
httpd.conf: php_value foo baz
.htaccess: php_value foo qux
ini_set: ini_set('foo', 'kittens');
.user.ini foo=bar # this file works conditionally see https://stackoverflow.com/a/32193087/1818723
Given that, the master
value is qux
, and the local
value is kittens
.

- 2,895
- 1
- 30
- 29

- 356,200
- 43
- 426
- 500
-
I understand this, I need to know when web-server will use master value instead of local value if the are different or it'll never happen – Liauchuk Ivan Oct 22 '13 at 14:38
-
10Based on what you wrote, wouldn't the master value be 'bar', since it's set in the php.ini file? – Aine Nov 03 '15 at 10:36
-
that gets murkey. .ini is what's in effect when the webserver child loads up php, but that can get overridden on a per-dir/per-site/per-whatever basis with the .conf and .htaccess overrides. but when line #1 of your script fires, that value is "qux", and is listed as the master. – Marc B Nov 03 '15 at 14:29
-
1@Aine Yes, the "master value" (as reported by `phpinfo()`) would indeed be "bar" in this example. This is as stated in the first paragraph of the answer (not sure why the apparent change in reasoning in the example?). Setting a PHP config value in `httpd.conf`, `.htaccess` or `.user.ini`, etc. does not change the reported "master value", only the "local value" is changed. – MrWhite Feb 14 '17 at 18:58
-
2It is not clear in the answer that a .user.ini file can also change the local value. I recommend that the answer be edited to make that clear. – Jeff Baker Aug 26 '17 at 19:56
-
3@MarcB : I think according to the first paragraph of the answer the last line of the answer should be "Given that, the master value is bar, and the local value is baz(if set in httpd.conf), qux(if set in .htaccess), kittens(if set using ini_set)". If I've understood the concept correctly and the last statement which I suggested is also correct, please change the last statement of the answer to the one I suggested to clear the confusion. – PHPLover Mar 13 '18 at 04:31
-
2@MarcB : Please update your answer to clear the created confusion over the `master value` `qux` – PHPLover Aug 30 '18 at 06:58
-
1@PHPLover - what do you mean by "local value is baz (if set in httpd.conf)", etc.? At the time phpinfo runs, *all* those locations have taken effect, so the local value is "whatever value `foo` was set to most recently [last]", which in his example is `kittens`. It doesn't matter whether foo was set to baz in httpd.conf, if anything else set foo after that. – ToolmakerSteve Mar 29 '19 at 23:43
-
Downvoted because I think the last sentence should be changed as mentioned. – xdhmoore Nov 11 '20 at 01:34
"Master Value" (from php.ini) could be overridden with "Local Value" in httpd.conf, .htaccess or other Apache configuration with the php_value directive.
The first is the local value, and 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.

- 30,738
- 21
- 105
- 131

- 7,472
- 2
- 41
- 70
-
6So if, for example, local value = 0, but master value = 1440 web-server will use 0 always, right? – Liauchuk Ivan Oct 22 '13 at 14:36
-
7The 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; local value = 0 – Legionar Oct 22 '13 at 14:41
The hosted website will check local values in .htaccess
or .user.ini
first. (These files are in your local website folder and also can say local level configuration files.)
Local values override Master values, so php
will check the local values first.
The master value is set in php.ini
(main PHP configuration file).
Run the following commands in the 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 in .htaccess
or .user.ini
.
Here is explanation when .htaccess
vs .user.ini
works https://stackoverflow.com/a/32193087/1818723

- 2,895
- 1
- 30
- 29

- 61
- 1
- 5
-
What do you mean by *"also can say local level configuration files"* (seems incomprehensible)? Please respond by [editing (changing) your answer](https://stackoverflow.com/posts/55550055/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen Aug 10 '21 at 22:43
local is website-or-user wide while master is system-wide configuration option.
would be easier and quicker to understand if it's named "global" instead of master
since the hidden .user.ini
and .htaccess
files are site-wide they contain local values along with the ini_set
function to set options within the .php
file
the PHPRC
and PHP_INI_SCAN_DIR
files would contain the master (global, system-wide) values
PHPRC
: /etc/php.ini
PHP_INI_SCAN_DIR
: /etc/php/*.ini

- 166
- 7