Question

My Wordpress site is installed in a LAMP stack (Linux, Apache, MySQL, PHP).

Suppose I encounter HTTP error 500. What logs might help diagnose the issue? How can the logs be enabled? What are the normal filenames, and where are the log files normally stored?

I know it is possible to log some errors by adding these lines to wp-config.php

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

What other logs should be reviewed?

Was it helpful?

Solution

You are using Apache for your http server,it will keep it owns logs for access & errors, depending on how you have it configured.

By default Apache will probably use the following logs;

    /var/log/httpd/access_log
    /var/log/httpd/error_log

or

    /var/log/apache2/access_log
    /var/log/apache2/error_log

Log locations are in your Apache Config (/etc/httpd/). Check here for details.

Using WP_DEBUG

The WP_DEBUG flag will cause excessive logging of information, notices, warnings, errors, critical, etc.

WP_DEBUG_LOG when set to true saves information to /wp-content/debug.log

WP_DEBUG_LOG can have a log path set, for example;

define( 'WP_DEBUG', 'true' );    
define( 'WP_DEBUG_LOG', '/tmp/wp-errors.log' );

You can get more info on debugging here. It is also worth noting it is not recommend using WP_DEBUG on production sites.

My advice, before enabling debug, would be view the access & error logs for your http server (Apache in your case). They might yield the information you need without the need for WP_DEBUG.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top