Hello All.

Hope you can help with this.

My php.ini has error reporting as off. (obviously for secuirty)

I have put in my scripts to include the following code.

error_reporting(E_ALL);

But I am still not getting the errors just blank pages.

Any ideas how to get my errors for debugging.

Thanks if you can help

Lee

    I think if it is turned off in php.ini, it can not be overridden with error_reporting().

    There may be a way to enable it on a per site basis by using php_flag and php_value directives within a virtual site container in Apache's config.

    Have a look at this user comment on error_reporting() in PHP manual:-
    http://www.php.net/manual/en/function.error-reporting.php#54110

    Hope this helps a little. If you find a way of doing it can you post how you did it?

      Installer wrote:

      display_errors (in .htaccess or php.ini).

      I don't think display_errors will show fatal errors if error_reporting is turned off in php.ini.

        Even if display_errors is off, error_reporting should really be at its highest level permanently.

        You can then view errors / warnings in your error log - which is defined in php.ini (or can be sent to the Apache error log).

        You could also write a custom error handler which puts them somewhere else, or sends mail etc.

        We have a custom error handler which collects lots of information and (in production environment) emails us, with things like post fields, cookies, and a stack trace.

        Be aware that doing so might email private data though - so if using HTTPS, it's probably better to log it to a file rather than put these things in (an unencrypted) email

        Mark

          20 days later

          On this subject, I have a question related to error handling - I just discovered register_shutdown_function() whihc is cool, but how do I detect the "current error state" of a page, ie.e whether it's in warning, notice, or error? I need this in my shutdown function to determine whether or not to send output to an error file, email me, etc..

          Thanks,
          Samuel

            Don't use a shutdown function for that purpose, simply write a custom error handler instead and register it with set_error_handler.

            We use a custom error handler that will terminate the script, and optionally print out the error with a stack trace and/or send an email.

            During development, it shows the error in the browser (with stack trace). In production, it emails a detailed report to the developers.

            In both, it logs the error on the PHP error log and halts the script. This applies even to E_NOTICE events.

            The principle I use, is that any error should not happen, and therefore the script has failed and must be terminated before it causes some damage.

            Mark

              Write a Reply...