Additionally, you could rename your current ini file to something other than php.ini and restart PHP so that ini_get_all will give you the values which are baked into the core and use parse_ini_file() on your renamed file. – MonkeyZeus
This worked a charm! Before starting, I had a linked conf.d
and I had overridden the cli/php.ini
file to point to the apache2/php.ini
file so that my php cli invocations would use the web server configs. The cli/php.ini
file had been renamed .old
, like so:
$ ls -l /etc/php5/cli/
total 68
lrwxrwxrwx 1 root root 9 Apr 24 2013 conf.d -> ../conf.d
lrwxrwxrwx 1 root root 25 Mar 13 05:04 php.ini -> /etc/php5/apache2/php.ini
-rw-r--r-- 1 root root 67629 Mar 4 2013 php.ini.old
I took the web server out of our load balancer pool and made some modifications.
$ rm /etc/php5/cli/conf.d /etc/php5/cli/php.ini
$ php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: (none)
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: (none)
I then added a file called check_config.php
with these contents:
echo("
Defaults that are changed by or not present in ini file $path:
");
print_r(array_diff_assoc($defaults, $ini));
echo("
Values set by $path which differ from or are not included in the defaults:
");
print_r(array_diff_assoc($ini, $defaults));
And got some delicious output.
$ /usr/bin/php /etc/php5/cli/check_config.php
Defaults that are changed by or not present in ini file /etc/php5/apache2/php.ini:
Array
(
[allow_call_time_pass_reference] => 1
[allow_url_include] => 0
//...snip
)
Values set by /etc/php5/apache2/php.ini which differ from or are not included in the defaults:
Array
(
[engine] => 1
[asp_tags] =>
//...snip
)
This did what I wanted, but it has a lot of red herrings - a lot of directives have a default value but are not included in the ini file and similarly a lot of module specific directives that are not in the values returned by ini_get_all()
. I suppose I could improve this a bit by further finagling the config setups to enable more modules which should get their directives included in the list, but there are rather a lot of modules, so I think I'm good for now.