• Resolved SirLouen

    (@sirlouen)


    I find an issue with debugging:

    Sometimes while I’m developing something, I receive this error:

    There has been a critical error on this website. Please check your site admin email inbox for instructions.

    But I don’t receive any email.

    How can I simply debug from server logs instead of having to receive an email?

    I check the server logs and nothing is there ?? But this only happens with core things. Not with my own development elements.

    For example. Yesterday I removed this file
    wp-admin/includes/media.php

    And there it was:

    View post on imgur.com

    No server logs, no nothing.

    The problem here is that I removed it accidentally, and it took me a while to figure out this mistake.

    • This topic was modified 3 years ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 12 replies - 1 through 12 (of 12 total)
  • threadi

    (@threadi)

    Thread Starter SirLouen

    (@sirlouen)

    @threadi I’ve already read that and doesn’t solve any of my issues.

    I have all the constants to true but still no logging output server side.

    Still, I can see other logging output in my plugins. This only happens with features that affect /wp-admin

    Maybe there is something like define('WP_ADMIN_DEBUG',true)

    threadi

    (@threadi)

    Then you should contact your hoster. Because how PHP catches errors is a hosting setting. There should also be configured that the errors come into the server-side error log. Why the WordPress debug.log is not generated could also be related to this or with missing write permissions to the wp-content directory.

    Thread Starter SirLouen

    (@sirlouen)

    @threadi doesn’t make sense for me

    I get all the PHP errors, except for -exclusively- this.

    I can error_log from my plugins without issues.

    PS: I’m the system administrator, so I can edit all PHP settings. This only happens with WordPress, not with any other php services I have in my systems.

    threadi

    (@threadi)

    I have reproduced your example for myself. For me, a concrete error message appears:
    https://ibb.co/4M4VqSn

    And in the directory wp-content is in the debug.log:

    [13-Mar-2022 15:53:31 UTC] PHP Warning:  require_once(/var/www/clients/client0/web1/web/wp-admin/includes/media.php): failed to open stream: No such file or directory in /var/www/clients/client0/web1/web/wp-admin/includes/admin.php on line 35
    [13-Mar-2022 15:53:31 UTC] PHP Fatal error:  require_once(): Failed opening required '/var/www/clients/client0/web1/web/wp-admin/includes/media.php' (include_path='.:/usr/share/php') in /var/www/clients/client0/web1/web/wp-admin/includes/admin.php on line 35

    If this does not happen to you, you have set the constants mentioned in the above article incorrectly. For me they are in the wp-config.php directly above

    if ( ! defined( 'ABSPATH' ) ) {

    like this:

    // Enable WP_DEBUG mode
    define( 'WP_DEBUG', true );
    
    // Enable debug logging to the /wp-content/debug.log file
    define( 'WP_DEBUG_LOG', true );
    
    // Disable display of errors and warnings
    define( 'WP_DEBUG_DISPLAY', true );
    @ini_set( 'display_errors', 0 );
    
    // Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
    define( 'SCRIPT_DEBUG', true );

    If all this doesn’t work for you either, something is wrong with your installation. If you are using a composer installation of WordPress you have to change the settings in wp-config.php in the public directory.

    Thread Starter SirLouen

    (@sirlouen)

    Screenshot from the SSH of wp-config.php

    View post on imgur.com

    I’m using a tarball installation of WP. But this happens in all my WP installations, and only affects to admin area AFAIK.

    Looks so crazy ??

    I think this is not the first time I ask in this forum in the last couple of years, but I have never really found a solution.

    Not sure what can be wrong with my installation, after all its a bunch of PHP isn’t it?

    threadi

    (@threadi)

    Please check if the wp-config.php is actually used. An echo output followed by an exit is sufficient for this. If you then load the page and see the echo output, the file is loaded. If you don’t see the echo output this wp-config.php is not used. Then you have to check which one it is instead (if necessary search in all files for the database access data).

    Another tip: deactivate all plugins when you test this again. If any plugin interferes, this could also be the reason for this behavior. Please also activate one of the WordPress default themes (like TwentyTwentyOne) for testing.

    Thread Starter SirLouen

    (@sirlouen)

    Deactivated all plugins and as you said, it solved the issue.

    The weird part is that I reactivated them back one by one to see which could be the culprit, but now I can see all logs there…

    This kind of things freak me out a little bit ??

    threadi

    (@threadi)

    Is there anything among the plugins that could affect the debug settings?

    Do you use a cache plugin? Such a plugin could also be to blame for this.

    Thread Starter SirLouen

    (@sirlouen)

    Nope, for developing I don’t use cache things

    threadi

    (@threadi)

    Wise decision. I would recommend the next time it happens not to deactivate all plugins at once but only piece by piece until you notice that it doesn’t happen anymore. This way you would find the guilty plugin if necessary.

    By the way, I develop without any plugins. Only when I need one it is activated.

    Thread Starter SirLouen

    (@sirlouen)

    In this case that arose, is a development that affects multiple plugins so i need to have them all activated at once (something related with upgrades)

    But generally, as you say, I tend to develop without plugins. But it’s pretty weird what happened.

    In the future, I will be troubleshooting this way (full deactivating or the way you suggest, to try to identify if a plugin could be causing this for some reason, many plugins have multiple hidden functionality that hinders many things, specially those big ones with mvp frameworks within the plugin). I tend to forget about this a lot.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to debug in WordPress?’ is closed to new replies.