问题
If you run a phpinfo();
does it show exactly what is in the php.ini or if settings are changed on the fly via php with methods like ini_set()
or via .htaccess
will they be shown in phpinfo?
回答1:
phpinfo() shows, in the "Local Value" column, the current configuration ; i.e.
- what is in
php.ini
- eventually, overriden in Apache's
VirtualHost
or in.htaccess
files - eventually, overriden by
ini_set
In the end, it shows the configuration values that would be / are used by your script.
As a sidenote : it also display informations that are not-really "configuration" per-se, like the configure line that was used to compile PHP, the version of the Zend Engine, ...
回答2:
It will show the current running environment, not just what is in php.ini. Anything that changes the environment like the methods you mentioned will be reflected.
回答3:
I think that's what the meaning of the "global" and "local" columns is - "global" is what's set in the central php.ini, "local" is whatever changes have been applied to the global setting using one of the methods you describe.
回答4:
If you use ini_set()
, the changes are made on-the-fly for the current script only, it does not permanently change php.ini
settings. The phpinfo()
shows current settings of what is there in the php.ini
file which is also influenced by apache and ini_set
function.
回答5:
phpinfo()
always display the settings value in 2 column. First column is the global value that set in php.ini
file. Second column is per user value, that set in php.ini
or can be override by .htaccess
file or override through ini_set
before calling phpinfo()
.
Please note that not all settings value can be override by .htaccess
or ini_set
. See the complete list here and take a look at Changeable column. See the explanation og the Changeable column value here.
Try it by yourself.
来源:https://stackoverflow.com/questions/2327830/where-does-phpinfo-get-its-info