Notice: Undefined index: message in /home/example.php on line 9

If  you’re getting this message on PHP this is due to your PHP error reporting settings not being set correctly.

You can suppress the Notice warnings by changing the error reporting settings on PHP.ini (permanent change) or adding an extra line to your PHP script.

Changing PHP.ini:

Changing your PHP.ini makes the change permanent and available to every PHP script you run.

  1. Edit your PHP.ini file
  2. Locate the line that has error_reporting without the ; in the beginning (ex: error_reporting = E_ALL)
  3. Change this to error_reporting = E_ALL & ~E_NOTICE
  4. Save PHP.ini

Adding line to your script:

Just add the following line to the beginning of your script:

error_reporting (E_ALL ^ E_NOTICE);


error_reporting = E_ALL & ~E_NOTICE tells the system to show all errors and warnings except those for notices.

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.