- PHP

What to do if PHP errors are not showing?

Lack of PHP errors is usually caused by the server’s configuration. Sometimes, it is also disabled in the code or even .htaccess file.

This code should allow you to display PHP errors:

<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');

?>

Use it at the beginning of your code, and make sure you are not using this in your production environment unless you want your users to see some code errors (it looks bad, unprofessional, and, what’s most important, it may be dangerous).

Alternatively, you can also find your php.ini file and change display_errors to on:

display_errors = on

If it was set to off.