WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to Configure Error Log for PHP Errors (6 posts)

  1. progwebe
    Member
    Posted 2 years ago #

    I am new to wordpress and php.
    I am using apache 2.2, php 5 and wordpress 3.3.2 on windows.

    I want to have php errors in a log file. I am adding following lines at the end of wp_config.php file of a newly installed blog:

    define('WP_DEBUG', true);
    @ini_set('log_errors','On');
    @ini_set('display_errors','Off');
    @ini_set('error_log','C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\w\php_error.log');

    Then i am adding an error in index.php file of blog and expecting php_error.log will be populated but it is not. Instead, 'error.log' file under 'Apache2.2\logs' is being populated with error message.

    apache service is running from administrator account on a standalone pc.

  2. Marventus
    Member
    Posted 2 years ago #

    Hi!
    Take a look at this article.
    Cheers!

  3. progwebe
    Member
    Posted 2 years ago #

    Many thanks for the replying! I followed the article you mentioned but debug.log file is not being populated and i am getting a white screen. I am getting an error message mentioning 'php parse error...' in 'error.log' file of Apache.

    What should i do now?

  4. Marventus
    Member
    Posted 2 years ago #

    You must have an error in your PHP code somewhere.
    Try to revert to an older working version of wp-config.php and only add the lines that you need to enable wp_debug and log the errors.

  5. progwebe
    Member
    Posted 2 years ago #

    I have one error but it was added by me in index.php under root wordpress folder to get an error message for populating the debug.log file.

    I restored wp_config.php file. Now, it has only these new lines except for the modification of db connection:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors',0);

    Note :- If i remove the self introduced error from index.php file, my blog works fine.

    Can you kindly tell why the debug.log file is not being populated?

  6. progwebe
    Member
    Posted 2 years ago #

    Hi,

    I removed the self introduced error from index.php file and it has started populating debug.log file with PHP Notice messages.

    I think, debug.log file or even a file set with the following config will not log syntax errors of php:

    @ini_set(’log_errors’,’On’);
    @ini_set(’display_errors’,’Off’);
    @ini_set(’error_log’,’/public_html/wordpress/php_error.log’);

Topic Closed

This topic has been closed to new replies.

About this Topic