How to find out which php.ini file PHP is using?
October 26, 2018
To find out which php.ini file (and its full file path) just run the following command:
php --ini
Which will output something like this:
$ php --ini Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none)
If you need to check from within a PHP script, you can either put this code in (if it isn't public facing) and search for 'Loaded configuration file':
<?php phpinfo(); ?>
Or run:
<?php var_dump(php_ini_loaded_file()); ?>
See also: php_ini_scanned_files()