How to display php error message on webpage in firefox?

Here is my simple code file in /var/www/read.php:

error_reporting(E_ALL);
<?php
    echo hello"
?> 

I encountered an error message when running `php / var / www / read.php 'on the debian console.

PHP Parse error:  syntax error, unexpected '"', expecting ',' or ';' in /var/www/read.php on line 3

But there is no error message on the webpage when typing 127.0.0.1/read.phpin firefox.

I set the values ​​in php.ini as follows:

error_reporting = E_ALL & ~E_NOTICE    
display_errors = On  

I do not need to restart apache2 with the command:

service apache2 restart

Here is my phpinfo post. It makes no sense to add two lines to my read.php file, no error is reported in my firefox. How can i fix this? My system is debian7 + php.

<?php
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    echo hello"
?> 

find  /  -name  'php.ini'
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

The problem is resolved according to PHP does not show any errors

enter image description hereenter image description hereenter image description here

+4
source share
6 answers

-, error_reporting() <?php ?>.

php.ini( -, ).

unix - /etc/php, , /etc/php/apache2/php.ini.

, PHP -, phpinfo(); - configuration file.

, -, Apache, .

, ini_set.

, - .

<?php

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

foobar();

:

ini_set('display_errors', 1); , , script . , . , .

+5

error_reporting(1); error_reporting(TRUE); , , -,

+2

php

// Report all PHP errors
error_reporting(-1);
+1
//To show errors
ini_set('display_errors', 1);
error_reporting(E_ALL);

//To hide error 
ini_set('display_errors', 0);

php .

+1

, php.ini Apache. php.ini, Apache.

phpinfo() , Apache.

read.php :

init_set("display_errors", 1);
0

PHP , . , include:

<?php
    ini_set('display_errors',1); 
    error_reporting(E_ALL);
    include "/var/www/read.php";
?> 

, PHP "", .

, :

<?php
    error_reporting(E_ALL);
    echo "hello";
?> 

, PHP, PHP. , Firefox, .

, . .

( ). ... , , ?>, PHP ; . , ; , .

, , , , ini .

<?php
    ini_set('display_errors',1); 
    error_reporting(E_ALL);
    echo "hello world";
    unknownfunction() // this will throw errors
?> 

, , , , safemode. , ini ( , ).

Here are some additional notes that may be of interest:

0
source

All Articles