We help IT Professionals succeed at work.

lower the error reporting level in php.ini

Sabrin
Sabrin asked
on
Medium Priority
386 Views
Last Modified: 2011-09-20
hello,
how can I lower the error reporting level in php.ini?
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
full technical article:
http://php.net/error_reporting

Author

Commented:
I dont want to get technical thats why im asking here!
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
but changing the setting in the php.ini IS technical.
the doc tells you want value to set to get a certain behaviour.
the doc also tells you that you can change the behaviour at run time using error_reporting() function.

there are also other settings that can influence error display:
http://php.net/manual/de/ref.errorfunc.php#errorfunc.constants

setting the error level to 0 will show no errors at all

Author

Commented:
what If I have this (error_reporting  =  E_ALL) in php.ini
and this (LogLevel   crit) in httpd.conf

will I see any errors in the browser ?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
you will see all php errors, but only critical apache errors
Top Expert 2007

Commented:
If you see errors in the rowser depends on the php.ini setting display_errors. If its on all errors that match error_reporting are printed to screen. If display_errors is off no error (even fatal errors) will be displayed
Commented:
You don't need to change the error reporting in php.ini, you can do it on a script by script basis, which is neat for debugging only certain areas of code. for example:

<?php
// Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors (bitwise 63 may be used in PHP 3)
error_reporting(E_ALL);

?>

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
thank you
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.