Get Non-default INI Directives using --ini=diff Option in PHP 8.5

Get Non-default INI Directives using --ini=diff Option in PHP 8.5

The PHP CLI (Command Line Interface) provides the --ini option, which shows the path of the loaded configuration file (php.ini) as well as the scanned configuration directories. Since PHP 8.5, the --ini=diff option can be used to list INI directives that differ from the built-in default values. This offers a quick way to identify modified INI settings and is particularly useful in error reports highlighting configuration changes that may have caused an issue.

php --ini=diff

Output example:

max_execution_time: "30" -> "0"
memory_limit: "128M" -> "2048M"
post_max_size: "8M" -> "20M"
upload_max_filesize: "2M" -> "20M"

In this example, the values on the left represent PHP's default settings, while the values on the right show the current configuration overrides. Using --ini=diff helps quickly spot changes without manually comparing the php.ini file against PHP defaults. This can be especially helpful when troubleshooting misconfiguration issues, as it clearly highlights any non-standard settings in the environment.

Leave a Comment

Cancel reply

Your email address will not be published.