Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error_reporting(E_ALL) does not produce an error

Tags:

php

This is my PHP script -

<?php   error_reporting(E_ALL);   echo('catch this -> ' ;. $thisdoesnotexist); ?> 

Which obviously should show something if it were to be executed.

All I see is an empty page. Why is error_reporting(E_ALL) not working?

<?php   ini_set("display_errors", "1");   error_reporting(E_ALL);   echo('catch this -> ' ;. $thisdoesnotexist); ?> 

Does not help either. All I get is an empty page.

I've been to php.ini and set display_errors = On and display_startup_errors = On. Nothing happens.

like image 269
Samik Sengupta Avatar asked Jun 05 '13 07:06

Samik Sengupta


People also ask

How do I enable error reporting in PHP INI?

The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); The ini_set function will try to override the configuration found in your php. ini file.


1 Answers

Your file has a syntax error, so your file was not interpreted, so settings were not changed and you have a blank page.

You can separate your file in two:

File index.php

<?php     ini_set("display_errors", "1");     error_reporting(E_ALL);     include 'error.php'; 

File error.php

<?     echo('catch this -> ' ;. $thisdoesnotexist); 
like image 126
sectus Avatar answered Oct 19 '22 06:10

sectus