Skip to content
Advertisement

Php doesn’t show errors sometimes and other times it shows

I have this:

<?php
ini_set('display_errors', 'On');
error_reporting( E_ALL | E_STRICT );
dsadafsaf();

This show error in normal way like this:

Fatal error: Uncaught Error: Call to undefined function dsadafsaf()

But this:

<?php
ini_set('display_errors', 'On');
error_reporting( E_ALL | E_STRICT );
dsadafsaf
//without () to ask for a function, should give me parse error right?

Instead of show the error, gives me HTTP ERROR 500

I’m using php 7.4 as php-fpm

I tried to use only E_ALL instead of E_ALL | E_STRICT

Advertisement

Answer

The reason this is happening is because the parse error is being triggered and stopping the file from being compiled. Because it is not compiled, PHP doesn’t know to set display_errors = On.

You need to modify the php.ini file and set the value there.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement