One thing I always find myself doing and having to lookup on Google is how to set PHP error reporting without having to edit my core php.ini settings.
For the life of me I just can not remember it. I should probably store this as a code snippet within my IDE especially as I use PHP Storm from JetBrains. I find the functionality just beautiful with Magento 2 development, but I’m going off track, so to the task at hand.
To enable error reporting in a PHP script without editing the php.ini file add the following to the start of the script.
ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
If developing for Magento 2 and you can’t or don’t want to edit your php.ini file just add this into the application root index.php file.
Normally within your development environment you will have already set your php.ini file to enable these settings globally.
This error reporting can often be invaluable when debugging scripts or applications. However, needless to say but I will anyway these settings should not be left permanently in any production environment.