WordPress.org

Support

Support » Plugins and Hacks » How to display fatal PHP errors

How to display fatal PHP errors

  • I find it extremely tedious to debug my plugins and themes, because I simply can’t get WP to display PHP errors. I get either white screen or a partially loaded page, ending where the error is.

    So at the moment I debug by going through my code and putting in dummy echos different places to see where the script fails, slowly getting closer to the problem, which often is just a typo.

    In some cases the error does display, but mostly not.

    I tried all the advice you find on forums/blogs, etc.
    – Putting php_flag display_errors on in .htaccess
    – define(‘WP_DEBUG’, true); in wp-config.php
    – define(‘WP_DEBUG_DISPLAY’, true); in wp-config.php
    – php.ini display_errors is set to on

    Nothing works. I can only get it to display the useless Notices, never the fatal PHP error that makes the script fail.

    Hope someone can help, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi
    Forum Moderator

    @esmi

    Try looking in your server’s error.log file.

    That only shows server errors and not PHP errors.

    I’m looking for a way to stop WordPress from preventing the PHP errors to appear on screen as they would normally do..

    Anyone?

    giant slayer
    Member

    @giant-slayer

    I am having the same issue now. Previously, I was getting the php error displaying on the web browser with the error type and the line number it was on, but with the latest wordpress upgrade, I am no longer seeing the php errors on the screen. Now it is just showing a blank page.

    esmi
    Forum Moderator

    @esmi

    If this is a live site, that would be correct. Displaying errors can create security problems as you may be exposing paths etc to would-be hackers. But you can enable error logging in WordPress – although I would not recommend that it is left on for any length of time on a live site.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to display fatal PHP errors’ is closed to new replies.