Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
316 views
in Technique[技术] by (71.8m points)

php - error_reporting(E_ALL) does not produce error

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.

question from:https://stackoverflow.com/questions/16933606/error-reportinge-all-does-not-produce-error

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

You can separate your file to two.

index.php

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

error.php

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...