Disable PHP Warning Message
I wanted to disable my warning message from my php installation. To do so
I need to configure my php.ini file. I searched on the internet but couldn’t find a direct answers where to change my php.ini on MacOS Catalina.
Location of php.ini File at MacOS Catalina
For MacOS Catalina the location of php.ini is located at /etc/
You can verify it by printing phpinfo() and look for “Loaded Configuration File (php.ini) path”
For my MacOS Catalina, the location of php.ini is located at /etc/. As you can see there is no php.ini is loaded (None).
Load Your Own php.ini File
To load your own php.ini, copy the default file into your new php.ini
sudo cp /etc/php.ini.default /etc/php.ini
Open the php.ini, in this case I’m using atom to open it.
sudo atom /etc/php.ini
Then change php error reporting into
error_reporting = E_ERROR
Save it then restart apache.
sudo apachectl restart
Then check the php.ini file is loaded correctly by printing the phpinfo. It will shows /etc/php.ini at “Loaded Configuration File” row.
or you can run php –ini to see the loaded configuration file.
When you refresh the website, the warning php message will disappear.