WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to Configure Error Log for PHP Errors

[Resolved] How to Configure Error Log for PHP Errors

  • 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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Marventus
    Member

    @marventus

    Hi!
    Take a look at this article.
    Cheers!

    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?

    Marventus
    Member

    @marventus

    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.

    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?

    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’);

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] How to Configure Error Log for PHP Errors’ is closed to new replies.