Get all of the configuration options in one handy array. This is good for looking up a number of values without having to use so many ini_get() calls.

You’ll get the “master value” as well as the “local value”. The local value may be different from the master value if it has been changed with ini_set() or in an .htaccess file. You also get the access level which will be explained later.

Instead of obtaining all values, you can optionally pass it the name of an extension and get only those values.

$vals = ini_get_all('mysql');
/*
array (
  'mysql.allow_persistent' => 
  array (
    'global_value' => '1',
    'local_value' => '1',
    'access' => 4,
  ),
  'mysql.connect_timeout' => 
  array (
    'global_value' => '60',
    'local_value' => '60',
    'access' => 7,
  ),
...
*/

As of PHP 5.3 the addition of a second parameter, details, set to false will return you only the current values. That is, you won’t get the master and local values, only the values the script will be using. Access levels are left out as well when details is set to false.

$vals = ini_get_all('mysql', false);
/*
array (
  'mysql.allow_persistent' =>  '1',
  'mysql.connect_timeout' =>  '60',
...
*/

Access Levels

As you recall from the entry on ini_set(), not all values can be changed in the script at run time. There are permissions, or access levels, for each setting which can be seen here and explained below.

Constant Value Meaning it can be set in…
PHP_INI_USER 1 user scripts
PHP_INI_PERDIR 2 php.ini, httpd.conf, .htaccess
PHP_INI_SYSTEM 4 php.ini, httpd.conf
PHP_INI_ALL 7 anywhere