How can you enable error reporting in PHP?

Check if “display_errors” is equal “on” in the php.ini or declare “ini_set(‘display_errors’, 1)” in your script. Then, include “error_reporting(E_ALL)” in your code to display all types of error messages during the script execution.

display_errors = on

ini_set('display_errors', 1)

error_reporting(E_ALL)

Enabling error messages is very important especially during the debugging process as one can instantly get the exact line that is producing the error and can see also if the script in general is behaving correctly.

Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Yes0
No0
Harinder Singh

Harinder Singh

My name is Harinder Singh and I specialize in Software industry. I consider myself as a life learner. I love learning new concepts, embracing new ideas and reading and searching for innovation.