skip to Main Content

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

Answers


  1. 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();
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search