errors – PHP Blog https://blog.dev-php.site Snippets and guides Sun, 14 Apr 2019 06:51:44 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.4 PHP Errors and Logging Settings https://blog.dev-php.site/php-errors-and-logging-htaccess/ Wed, 03 Apr 2019 18:02:33 +0000 http://blog.dev-php.site/?p=47 Continue reading PHP Errors and Logging Settings]]> PHP .ini file

Locate the section “Error handling and logging”, This directive informs PHP of which errors, warnings and notices you would like it to take action for.

You will see and be able to alter these config settings

error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On

Error Reporting

This directive informs PHP of which errors, warnings and notices you would like it to take action for.

To show only errors, (no warnings or notices)

error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

If you do only display errors, you will not be able to see common run time notices and warnings such as

NOTICE Undefined variable: var on line number 2

Display Errors

Just because error reporting is turned on, you wont be able to see the errors unless the display_errors flag has the on value

To show only errors, (no warnings or notices)

display_errors = On
]]>