WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to test php error logging (6 posts)

  1. alvarix
    Member
    Posted 4 years ago #

    I just set up the error logging as explained in this codex page:
    http://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Log

    @ini_set('log_errors','On');
    @ini_set('display_errors','Off');
    @ini_set('error_log','/home/example.com/logs/php_error.log');
    at the top of wp-config.

    I don't think it's working because hitting a blank page (due to a php error presumably) writes nothing to the log file. In the past I've had trouble getting this to work.
    The log file is 660 and sits in the public webroot.

    Is there anyway to test this?
    Thanks,
    alvar

  2. Mark / t31os
    Moderator
    Posted 4 years ago #

    From the link above.

    If WP_DEBUG is defined to true, the errors will also be saved to this file.

    Do you have debugging on?.. (done by editting config.php)

  3. alvarix
    Member
    Posted 4 years ago #

    Thanks. I added that and it certainly populated my error log.
    However I still have two problems:

    1. Enabling wp_debug prints php errors to screen. That is not very cool. Is it meant to just be turned on when you are actively debugging?
    2. I created a test page with an intentional php error, test.php. Visting the page I saw the error printed to screen, but it didnt show up in the error log.

    Any ideas? Thanks again.

  4. Mark / t31os
    Moderator
    Posted 4 years ago #

    Debugging is for 'debugging', it's not intended as an always on feature, or at least that's my understanding..

    You host should give you a log option for the main errors you need to aware of..

    For anything else, use PHP's error reporting...

    wp_debug does print to screen, it's debugging mode... very handy when doing debugging though, i've used it quite a bit....

    Here's a good article in relation to PHP error reporting.
    http://perishablepress.com/press/2008/01/14/advanced-php-error-handling-via-htaccess/

  5. alvarix
    Member
    Posted 4 years ago #

    I thought the point was to give you quick access to php settings:

    Because wp-config.php... it is an excellent location to set php ini settings that control your php installation.

    Anyway, thanks for your insight.

  6. Mark / t31os
    Moderator
    Posted 4 years ago #

    PHP ini settings are not something you may have control over, that's managed by whoever runs the server, in most cases this is your webhost..

    Some settings can be changed (via .htaccess etc..), but some will simply be out of reach unless you have a dedicated or virtual host (is that the term - been a while)..

    It really depends what kind of hosting you have and the kind of access you have to said PHP settings, for the most part these aren't something average joes gets to fiddle with... (including me with my host - but then i don't need that).

Topic Closed

This topic has been closed to new replies.

About this Topic