6

It's the first I have seen this. In a project I'm working on, I tried to switch on the debug mode for wordpress to see logs. Even if I activate the debug_log in wp-config.php, debug.log file is never created in /htdocs/wp-content/

wp-config.php

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

@ini_set('display_errors',0);

define('SCRIPT_DEBUG', true);

wp-content dir rights

enter image description here

load.php

if ( WP_DEBUG_LOG ) {
    ini_set( 'log_errors', 1 );
    var_dump( WP_CONTENT_DIR . '/debug.log' );
    // display correctly this => "/htdocs/wp-content/debug.log";
    ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
}
  • 1
    The writability of that folder is server specific, and not just the chmod, but the ownership of the folder is important. Having said that it looks like you're on a VPS, why not just use the PHP error logs instead? – Tom J Nowell Mar 15 '18 at 19:27
  • @Tom J Nowell I'm using the plugin debug log to see logs in wordpress admin. I'm trying to trace with error_log() which files are really loaded in a broken project of one customer. This plugin needs this file. So... Sould I talk with my client to change wp-content rights on the server side ? – J.BizMai Mar 15 '18 at 19:35
  • hmmm that sounds like a suboptimal approach, can you not run the site locally? Then you could run it and watch the php error logs in realtime, or use a debugger – Tom J Nowell Mar 15 '18 at 19:42
  • I'm waiting for the database access to copy all data and work it on localhost. – J.BizMai Mar 15 '18 at 19:53
  • It's a very old and suboptimal way to debug things, the codex is very old, and there are far better ways to do it, especially on a local environment where you can use a real debugger. Are PHP error logs not available? All WP_DEBUG_LOG does is change where the log files location is – Tom J Nowell Mar 15 '18 at 19:54
7

I found the problem. In the Apache server, inside the php.ini, the variable...

track_errors = Off

To get this information, you can do in a phpfile phpinfo();. So, to write the debug log file, you need to set track_errors as 'On'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.