• Over the past week we’ve had at least 10 cases where a site goes offline because the wp-config.php script empties out completely. The only thing in common with all these sites is they are running CE and an update occurs at the time the site goes down, example:

    # stat wp-config.php
    Access: 2021-09-16 08:22:02.946054498 -0500
    Modify: 2021-09-16 08:22:02.945054484 -0500
    Change: 2021-09-16 08:22:02.945054484 -0500
    
    # stat inc/cache_enabler.class.php inc/cache_enabler_disk.class.php
    Access: 2021-09-16 08:22:02.335045458 -0500
    Modify: 2021-09-16 08:21:57.994981245 -0500
    Change: 2021-09-16 08:21:57.994981245 -0500
    
    Access: 2021-09-16 08:21:57.999981319 -0500
    Modify: 2021-09-16 08:21:57.995981260 -0500
    Change: 2021-09-16 08:21:57.995981260 -0500
Viewing 9 replies - 1 through 9 (of 9 total)
  • Anonymous User 16850768

    (@anonymized-16850768)

    Are there any errors at or around the same time when this issue takes place?

    This happened also to us when updating from 1.8.5 to 1.8.6.

    Anonymous User 16850768

    (@anonymized-16850768)

    @sippis, did you happen to have any errors logged at that time that may shed more light on what occurred? Furthermore, do you happen to be using any of the WordPress option hooks, such as pre_option_cache_enabler, filtering the Cache Enabler settings before being saved in the database? I bet that is highly unlikely, but just thought I’d check as another user had the same issue due to that.

    I’ve tried many times to replicate this but still haven’t been able to. Would you be willing to share your Site Health Info so I can have more details on a site this occurred on? The Site Health Info can be obtained by going to the WordPress dashboard > Tools > Site Health > Info > Copy site info to clipboard. It can be shared privately through our contact form while referencing this thread if you’d prefer.

    @coreyk Sorry I didn’t have time earlier today to really find out what happened in detail.

    Tried to reproduce the issue as well a moment ago, in the very same site and environment, failing in it. Did do 1.8.5 -> 1.8.6 update via update-core.php and via ManageWP as well – everything went smoothly.

    Some details that might or might not be helpful:
    * WordPress Multisite
    * Update was done via ManageWP
    * Site uses Bedrock based stack, dudestack
    * There is a cronjob in place that removes (wp-)content/cache/cache-enabler every fifteen minutes
    * Another cronjob loops thru all the network sites and runs events due now

    do you happen to be using any of the WordPress option hooks, such as pre_option_cache_enabler, filtering the Cache Enabler settings before being saved in the database?

    Nope, no pre_option_* in use.

    I can see few messages in the log that might be interesting/helpful. A useful little piece of information is the plugin update was done at 13:16.

    What bugs me, is that we started seeing core related errors before there was anything CE related. Thought that might be because of the first error with timestamp 13:16:59 which looks like an infinite loop exhausted to me. Note the file_put_contents error there for one of the network sites setting file.

    13:16:53 [error] PHP Fatal error:  Uncaught Error: Call to undefined function force_ssl_admin() in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-login.php:15
    
    13:16:55 [error] PHP Fatal error:  Uncaught Error: Call to undefined function send_origin_headers() in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/admin-ajax.php:25
    
    13:16:55 [error] PHP Fatal error:  Uncaught Error: Call to undefined function wp() in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-blog-header.php:16
    
    13:16:59 [error] PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  file_put_contents(/var/www/redacted.fi/deploy/releases/20210215095505/content/settings/cache-enabler/www.redacted.fi.network-website-slug.php): failed to open stream: No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/content/plugins/cache-enabler/inc/cache_enabler_disk.class.php on line 430PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct.php on line 173PHP message: PHP Warning:  chmod(): No such file or directory in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-admin/includes/class-wp-filesystem-direct
    
    13:16:59 [error] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /var/www/redacted.fi/deploy/releases/20210215095505/content/plugins/query-monitor/classes/Backtrace.php on line 99PHP message: PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-includes/class-wp-fatal-error-handler.php on line 72PHP message: PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-includes/plugin.php on line 4475" while reading response header from upstream, client: 54.191.137.17, server: redacted.fi, request: "POST /wp-load.php?mwprid=<redacted> HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.redacted.fi.sock:", host: "redacted.fi", referrer: "https://redacted.fi/"
    
    13:16:59 [error] PHP Fatal error:  Uncaught Error: Call to undefined function wp() in /var/www/redacted.fi/deploy/releases/20210215095505/wp/wp-blog-header.php:16

    Here’s the Site Health Info.

    
    ### wp-core ###
    
    version: 5.8.1
    site_language: fi
    user_language: fi
    timezone: Europe/Helsinki
    permalink: /ajankohtaista/%year%/%postname%/
    https_status: true
    multisite: true
    user_registration: false
    blog_public: 1
    default_comment_status: closed
    environment_type: production
    user_count: 28
    site_count: 9
    network_count: 1
    dotorg_communication: true
    
    ### wp-dropins (4) ###
    
    advanced-cache.php: true
    db.php: true
    object-cache.php: true
    sunrise.php: true
    
    ### wp-active-theme ###
    
    name: <redacted (custom theme for client>
    version: <redacted>
    author: Digitoimisto Dude Oy
    author_website: https://www.dude.fi
    parent_theme: none
    theme_features: core-block-patterns, align-wide, wp-block-styles, widgets-block-editor, editor-styles, editor-style, widgets, menus, automatic-feed-links, title-tag, post-thumbnails, html5
    theme_path: /var/www/redacted.fi/deploy/releases/20210215095505/content/themes/redacted
    auto_update: Poistettu k?yt?st?
    
    ### wp-mu-plugins (8) ###
    
    0-air-helper-media-fix.php: author: Timi Wahalahti, version: (undefined)
    10-try-mediafiles-last-chance.php: author: Timi Wahalahti, version: (undefined)
    Bedrock Autoloader: version: 1.0.0, author: Roots
    dashboard-widget-upkeep-reminder.php: author: Timi Wahalahti, version: (undefined)
    ManageWP - Worker Loader: author: GoDaddy, version: (undefined)
    network-main-site-url-fixer.php: author: (undefined), version: (undefined)
    wp-cli-flush-rewrite-all-sites.php: author: Timi Wahalahti, version: (undefined)
    
    ### wp-plugins-active (30) ###
    
    Advanced Custom Fields: Network posts select field: version: 1.0.2, author: Timi Wahalahti
    Advanced Custom Fields: Relationship field from main site content: version: 1.0.0, author: Timi Wahalahti, Digitoimisto Dude
    Advanced Custom Fields PRO: version: 5.10.2, author: Delicious Brains
    Air helper: version: 2.11.1, author: Digitoimisto Dude Oy, Timi Wahalahti
    Broken Link Checker: version: 1.11.16, author: WPMU DEV
    Cache Enabler: version: 1.8.6, author: KeyCDN
    Gravity Forms: version: 2.5.11, author: Gravity Forms
    Hide SEO Bloat: version: 3.14.8, author: SO WP
    ICS Calendar: version: 8.5.0, author: Room 34 Creative Services, LLC
    Imagify: version: 1.10, author: WP Media
    Koko Analytics: version: 1.0.28, author: ibericode
    Mailgun: version: 1.7.9, author: Mailgun
    ManageWP - Worker: version: 4.9.10, author: GoDaddy
    Object Cache Pro: version: 1.13.3, author: Rhubarb Group
    <redacted (small custom client-specific plugin>: version: 1.0, author: Digitoimisto Dude, Timi Wahalahti
    Public Post Preview: version: 2.9.3, author: Dominik Schilling
    Query Monitor: version: 3.7.1, author: John Blackbourn
    Redirection: version: 5.1.3, author: John Godley
    Relevanssi Premium: version: 2.15.3.1, author: Mikko Saari
    Simple History: version: 2.42.0, author: P?r Thernstr?m
    Simple Page Ordering: version: 2.3.4, author: Jake Goldman, 10up
    CPT person: version: 1.0, author: Digitoimisto Dude Oy, Timi Wahalahti
    CPT project: version: 1.0, author: Digitoimisto Dude Oy, Timi Wahalahti
    CPT event: version: 1.0, author: Digitoimisto Dude Oy, Timi Wahalahti
    WP Sanitize Accented Uploads: version: 1.2, author: Onni Hakala / Geniem Oy
    WP Signups: version: 5.0.0, author: John James Jacoby
    WP SmartCrop: version: 2.0.5, author: Bytes.co
    WP Term Order: version: 1.0.0, author: John James Jacoby
    <redacted (small custom client-specific plugin>: version: 0.1.0, author: Digitoimisto Dude, Timi Wahalagti
    Yoast SEO: version: 17.2.1, author: Team Yoast
    
    ### wp-plugins-inactive (7) ###
    
    Classic Editor: version: 1.6.2, author: WordPress Contributors
    GAinWP Google Analytics Integration for WordPress: version: 5.4.6, author: IntelligenceWP
    <redacted (small custom client-specific plugin>: version: 0.1.0, author: Timi Wahalahti, Digitoimisto Dude
    CPT news: version: 1.0, author: Digitoimisto Dude Oy, Timi Wahalahti
    CPT X: version: 1.0, author: Digitoimisto Dude Oy, Timi Wahalahti
    CPT Y: version: 1.0, author: Digitoimisto Dude Oy, Timi Wahalahti
    CPT Z: version: 1.0, author: Digitoimisto Dude Oy, Timi Wahalahti
    

    Some details that should have no effect on anything are redacted from logs and health info.

    Anonymous User 16850768

    (@anonymized-16850768)

    Thank you, @sippis. That information has been quite valuable so I sincerely appreciate you sharing it. I need to investigate this a little further. Updates to follow shortly.

    Thread Starter justin-bigscoots

    (@justin-bigscoots)

    You guys need to stop touching wp-config.php, if you need to define

    define( ‘WP_CACHE’, true );

    then just put a warning to have the user actually do it.

    The amount of times we have a website go down because wp-config.php goes blank after an update is just insane.

    Thread Starter justin-bigscoots

    (@justin-bigscoots)

    I have to assume this is the issue..

            file_put_contents( $wp_config_file, $wp_config_file_contents, LOCK_EX );
    

    Are you checking these variables are empty before executing this?

    file_put_contents will overwrite the file if it exists and its safe to assume the variables are empty for whatever reason.

    Until you have some method that will without a doubt, 100%, rewrite the contents of wp-config.php you need to stop writing to it, just stop.

    If WP_CACHE is not defined then just alert the user to add it manually, you need to stop.

    Anonymous User 16850768

    (@anonymized-16850768)

    @justin-bigscoots, thanks for your feedback. ?? This is a free, open source plugin so we always welcome any contributions. I don’t believe that’s the root cause of the issue because the same handling has been used for the wp-config.php file for many, many versions. I think the issue was something else that I’ve addressed and will be available shortly, but unfortunately I can’t say for certain if it will as I can’t replicate the issue. The Site Health Info of the specific sites encountering this issue has been quite valuable information in helping resolve it.

    Anyway, you are definitely right that the handling for the wp-config.php file could be improved, which I actually already did recently. (What will likely be added can be found here in case you have any feedback.) That will also be available shortly.

    Thank you @coreyk for looking deeper into this and trying to solve the problem, even though you can’t reproduce it!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘CE plugin update to 1.8.4 randomly empties wp-config.php’ is closed to new replies.