How do I find my PHP configuration (php.ini) file?

The PHP configuration file can be in multiple locations.  Additionally, you may find that you have multiple instances of the php.ini file.  You can determine the location of the correct php.ini file by following this procedure.

If the ‘php’ (or ‘php.exe’ in Windows) binary is not in your PATH, you will need to navigate to the directory where it resides.

ex:
[*NIX]
cd /usr/local/bin

[Windows (using the CLI)]
cd C:\PHP

You can then run the PHP binary with the ‘-i’ argument and extract the php.ini location using ‘grep’ (or ‘find’ in Windows).

ex:
[*NIX]
./php -i | grep php.ini

[Windows (using the CLI)]
php.exe -i | find php.ini

The commands listed above will return the location of the PHP configuration file that your PHP installation is currently using.

Your rating: None Average: 3 (1 vote)