Finding Which php.ini Is Loaded

This is actually a throwback to the post Overriding PHP Settings, but is presented here separately due to the number of times the question is asked.

If you’re on a *NIX-based system and are trying to figure out which php.ini is being loaded by the CLI, simply run the following command:

ls -l `/bin/env php -i | grep "Loaded Configuration File" | sed 's/.*=> //g'`

If you want to edit the file right from that command, simply replace ‘ls -l’ with an editor of your choice, such as:

vi `/bin/env php -i | grep "Loaded Configuration File" | sed 's/.*=> //g'`

Share

2 comments

  1. kalanjali sarees

    Oh, I Don’t Know?. ยป Finding Which php.ini Is Loaded

  2. best ceiling insulation

    Oh, I Don't Know…. » Finding Which php.ini Is Loaded

Leave a Reply

Your email address will not be published. Required fields are marked *