Depending on the version and operating system, PHP can be installed in multiple locations. Fortunately, you can quickly locate the PHP.ini file by running this command:
How to Edit PHP.ini file
Look for Loaded Configuration File from the output, then edit the file using nano.
sudo nano /opt/homebrew/etc/php/8.0/php.ini