Find php.ini on Apple Silicon installed with Homebrew
Are you having trouble finding your php.ini file which was installed locally with Homebrew? Packages installed with Homebrew can be installed in different locations making it hard to find, especially if you are on new Apple Mac running Apple’s Silicon chips.
Here, I will show you home to locate your locally installed php.ini file installed via Homebrew.
Where are Homebrew packages installed?
After looking around online for some time, you may have stumbled across Stack Overflow posts stating that the packages are installed within the /usr/local/opts directory. However, this isn’t always the case.
On MacOS on Apple Silicon chips, Homebrew packages can be found in the /opt/homebrew directory.
How to find php.ini location
One of the easiest ways to find your php.ini file is to runphp from the terminal, like so:
php -r "phpinfo();" | grep php.ini
This will output the exact location of yuour current PHP versions php.ini file.