0
votes

VmWare Cloud Server

CentOS Linux 7.6.1810 - Php 5.6.40 - Apache/2.4.6

test.php

<?php
  echo($x);
  phpinfo();
?>

Output :

Notice: Undefined variable x in /var/www/html/test.php on line 1

In CORE section of phpinfo output I have

display_errors Off

display_startup_errors Off

error_reporting 0

Why Notice is shown?

I'd like not to show any error/notice/warning etc.

2
Try putting error_reporting(E_ERROR | E_PARSE); after <?php to avoid warnings. - kiner_shah

2 Answers

0
votes

It's possible that your settings are controlled in the htaccess file, see more info: https://www.php.net/manual/en/configuration.changes.php

But you can try this:

<?php
ini_set('display_errors', 0);
echo($x);
phpinfo();
0
votes

Try adding the following at the top of your PHP script :

<?php error_reporting(0); ?>

If the notice disappears, I would suggest making sure you are modifying the good php.ini file.