Extra Catchy

2 Ways to Display PHP Errors and Warnings (Without Modifying php.ini)

Posted in: PHP Web Development

If you want to see all the PHP errors and warnings, in order to debug the codes and easily pinpoint the line no of error and why that error has taken place?

Then this is the post you were looking for and you land at the right place.


We have embedded simple code that you just need to put in your any php file and after that, you will be able to see all PHP Errors…

…and what’s the best part is that you don’t need to modify your php.ini file for it.

Sounds good?

Let’s begin:

Display All PHP Errors

Just copy the below-embedded code and paste it into your file in which you want to display errors.

for eg: I need to display error on index.php file, so I will paste the codes into index.php file.

Code Snippets to Show PHP Errors:

Save the file and view the result in the browser.

Alternative code to show PHP errors

If That doesn’t work for you, try this one:

That’s it.

Hope the above code helped you to show errors easily.

Don’t forget to share this guide that enables reporting php errors messages.