I'm fairly certain I'm just missing something -- but I'm having issues debugging WordPress. I'm having an issue with Elementor and need to see any WordPress / PHP errors. I've changed the following in wp-config.php and restarted the app to no avail. The debug log doesn't seem to be created or logging in /wp-content/debug.log.
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false);
Any help with this would be greatly appreciated!
@jlx89 Try adding this to the config:
define( 'WP_DEBUG_LOG','/app/data/output.log' );This should tell wordpress to output to
/app/data/output.logwhich is outside the web root and also in a writable area of the container.
In addition to what @murgero said, you can also put things in
/tmp/debug.logas well. Note that the files under /tmp are cleaned up automatically periodically, so this can either be a plus or minus depending on your use case.
@murgero Thank you! I gave that a shot, but it still doesn't seem to be working. I am using the "WordPress Developer)" app -- but can migrate this over to a LAMP Stack, if needed.
@girish Thank you! I'll give the
/run/debug.logoption a shot. I'd like to be able to view them as needed, rather than having it stored in the
@jlx89 said in Debugging WordPress:
I am using the "WordPress Developer)" app -- but can migrate this over to a LAMP Stack, if needed.
The WP Developer app is essentially the same.
I quickly tried this out. I blindly put the defines you posted at the end of file and it did not work as well :-). It turns out, this was because in
wp-config.php, those constants are already defined. In around lines 75-77:
define( 'WP_DEBUG', false ); define( 'WP_DEBUG_LOG', false ); define( 'WP_DEBUG_DISPLAY', false );
I had to remove those duplicate lines, since I guess PHP does not allow re-defining constants.
After removing them, I added some junk in
random_function();and I see that debug.log is created once I visit WP.
@girish Yes, I had originally added them at the bottom of wp-config.php and realized they were already defined and changed the values. I added the following and restarted the app, to no avail. I'll give that another shot and see if that works out.
@jlx89 I noticed the file is not created, unless there is a real error. Did you put some error in a PHP file ?
@girish Yes, I did that --
error-logdoesn't seem to be created nor is anything logged in
@jlx89 I setup a test here - https://my.demo.cloudron.io/#/app/cc6803b8-c862-4a2b-8c12-e25c9a092592 . I put a bad func call here - https://my.demo.cloudron.io/filemanager.html?type=app&id=cc6803b8-c862-4a2b-8c12-e25c9a092592#public/wp-includes/functions.php . Maybe you can check what is different...
@girish So I replicated what you had done in the demo. So that seems to be working now -- after I disabled the plugins we have installed. I'm going to work through and go one-by-one on the plugins and see what is going on. This seems to be a really odd issue.