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.
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);
That error is a parse error . The parser is throwing it while going through the code, trying to understand it. No code is being executed yet in the parsing stage. Because of that it hasn't yet executed the error_reporting
line, therefore the error reporting settings aren't changed yet.
You cannot change error reporting settings (or really, do anything ) in a file with syntax errors.
In your php.ini file check for display_errors
. I think it is off.
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
In your php.ini file check for display_errors. If it is off, then make it on as below:
display_errors = On
It should display warnings/notices/errors .
Please read this
http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
you can try to put this in your php.ini:
ini_set("display_errors", "1");
error_reporting(E_ALL);
In php.ini file also you can set error_reporting();
turn on display errors in your ini
http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors
Just do the following
Check phpinfo();
// search display_errors
is on or off
If it is On
, just add error_reporting(E_ALL);
in your primary index file.
If it is Off
, just add it in your primary index file
ini_set("display_errors", "1"); //this is the instant setup for individual apps
ini_set("display_errors", "1"); //this is the instant setup for individual apps
error_reporting(E_ALL);
then check phpinfo();
// search display_errors
, now it is on
, which is only for this app
then create any code error for testing and reload the page
Hurray!!! Now you can see the errors in your console. If the errors is not displaying in your console and the page loading is failed with red alert in network? don't worry
Check if you're enabled the **modsecurity**
and it has any rule checking is written in SecRule
for php, remove that secrule or disable the modsecurity
for your development period
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.