Error activating WP_DEBUG

Asked

Viewed 115 times

2

I’m having a problem on my site in Wordpress. When I define in the wp-config.php, my site gets normal:

define('WP_DEBUG', false);

But when I define

define('WP_DEBUG', true);

The site gives page error not found. And I was needing to debug because I’m having another problem to solve...

Have any problem wp-debug getting set as true on a Windows server?

I’m using my website on a Windows server.

  • 1

    Out of curiosity, did you get a solution or did you find the problem?

  • Your answer helped me because I used it as a reference to find another answer that could help me. Only now I can’t remember how I solved it, I remember I based on your answer.

  • 1

    If at some point I bump into the solution again, it would be nice to have it registered here. Thanks!

2 answers

2

The WP_DEBUG constant displays problems and alerts related to settings, plugins and even security, therefore you cannot leave it active in a production environment.

When you set the WP_DEBUG to TRUE, make sure to clear the cache and observe the error log of your site, there may be displayed information about error 404 (which you claim is the page not found).

You can also set your Wordpress not to work with friendly Urls, in the permanent link options, so you should avoid 404 errors that apparently are a problem with the rewrite of your site. (make sure your . htaccess is being read correctly and you do not have Allowoverride None in your server settings).

There is a plugin that can check this for you:

https://wordpress.org/plugins/monkeyman-rewrite-analyzer/

1

Maybe debugging a file can work around the problem:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false ); // não mostrar na tela
define( 'WP_DEBUG_LOG', true ); // escrever debug em um arquivo
@ini_set('display_errors',0);

With the constant WP_DEBUG_LOG active, debug will be generated in the file /wp-content/debug.log. This constant is used to see Ajax or wp-cron errors that are not shown on the screen while running the site.

Some time ago, I made a plugin to view that file directly in the Wordpress backend.

If even using the direct debug to a file your website still doesn’t work because of these constants, then you should search your server’s error logs to see if there are any hints of what’s really going on. This solution I present is just an alternative to circumvent the actual error (WP_DEGUB conflict with your server), I did a quick search and found nothing related.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.