Struggling to debug PHP? Enable all errors
Last Updated on: November 27, 2022
If you have a problem debugging any PHP code, a good first step is ensuring all errors are showing. Simply use the following code at the beginning of your script:
error_reporting(E_ALL); ini_set('display_errors, 'On');
You may find that the server you are using or the code written by somebody else is hiding too many errors for you to work out what is going on.
Keep in mind you will also see many warnings that are not always significant (depending on your goals) – if this is the case, make sure you remove the above line after you are done.
Get notified of new posts: