wp-config debug 'false' or 'true'

admin2025-01-07  6

I'm getting huge php error logs and saw on a forum that the issue might be that I needed to set WP_DEBUG and DEBUG-LOG to 'false' (as 'true' is only needed on a development site. Makes snese, I suppose.

However, checking the wpconfig file just now, I see what appears to be two separate instances of WP-DEBUG, one set to 'false' and one to 'true'.

Can anyone tell me if this looks right or if somehow I've got a conflict/duplicate. If so can I delete one or maybe change 'true' to 'false' so they agree. Thanks for any help you can give me. (I'm cutting to the relevant section here.)

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', false);
$table_prefix  = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link 
 */
define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
define('FORCE_SSL_ADMIN', true);
define('WP_MEMORY_LIMIT', '384M');

/* That's all, stop editing! Happy blogging. */

I'm getting huge php error logs and saw on a forum that the issue might be that I needed to set WP_DEBUG and DEBUG-LOG to 'false' (as 'true' is only needed on a development site. Makes snese, I suppose.

However, checking the wpconfig file just now, I see what appears to be two separate instances of WP-DEBUG, one set to 'false' and one to 'true'.

Can anyone tell me if this looks right or if somehow I've got a conflict/duplicate. If so can I delete one or maybe change 'true' to 'false' so they agree. Thanks for any help you can give me. (I'm cutting to the relevant section here.)

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', false);
$table_prefix  = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the Codex.
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
define('FORCE_SSL_ADMIN', true);
define('WP_MEMORY_LIMIT', '384M');

/* That's all, stop editing! Happy blogging. */
Share Improve this question edited 20 hours ago Howdy_McGee 20.8k24 gold badges91 silver badges175 bronze badges asked 21 hours ago peegeebeepeegeebee 211 bronze badge New contributor peegeebee is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 1
  • I'd expect that to throw errors. Defining something twice should cause PHP to throw an error. This error will log every page load which is probably the problem. Define tells PHP "this will never change" and then it gets changed. – Matthew Brown aka Lord Matt Commented 14 hours ago
Add a comment  | 

1 Answer 1

Reset to default 1

You're defining WP_DEBUG_LOG twice, first as false and then as true. Doing some very rudimentary testing on my local PHP installation...

php > define( 'X', true );
php > define( 'X', false );
PHP Warning:  Constant X already defined in php shell code on line 1
php > print_r( X );
1

...it seems clear that the 2nd define will throw a PHP warning and then be ignored. So, if this is your wp-config.php file, WP_DEBUG_LOG is false.

You should still remove the duplicate line, though.

(I'd also recommend moving all the debug statements to after the /* For developers: WordPress debugging mode. […] comment block, since that's where most WP developers will look for it. It'll be less confusing that way, for you and for anyone else who might end up maintaining your system.)

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736252149a22.html

最新回复(0)