PHP has a large number of configuration options which can be set in the php.ini file, Apache virtualhost settings, .htaccess and with the ini_set function. This post looks at the ini_get_all function which returns an array containing all the possible configuration options, what their global and local script value are and where they can be modified.
Sample code:
Example output:
Accessing the values
The associative array that is returned contains a key name which is the configuration option name with a sub-array containing the keys 'global_value', 'local_value' and 'access'. If you wanted to find out the local value for 'allow_url_fopen' for example, you could do something like this:
Of course, you could also do the above using ini_get like this if all you needed was the local value:
Global value vs local value
The global_value contains the value that is set in the php.ini file. The local_value contains the modified value (if modified) in the <virtualhost>, .htaccess file or ini_set().
Access
Access uses the following PHP constants:
PHP_INI_USER | 1 | Entry can be set in user scripts |
PHP_INI_PERDIR | 2 | Entry can be set in php.ini, .htaccess or httpd.conf |
PHP_INI_SYSTEM | 4 | Entry can be set in php.ini or httpd.conf |
PHP_INI_ALL | 7 | Entry can be set anywhere |
The value can also be 6 i.e. PHP_INI_PERDIR + PHP_INI_SYSTEM.
0 comments:
Post a Comment