It seems every few months my wp-config.php is being overwritten to the wp-config-sample.php. Nothing else is corrupted or changed, just that. It started to do this early 2019. The host is Inmotion. I managed a dozen sites on Siteground and have never seen this issue before. The site in question uses Securi for malware protection and I have enabled files rights to 444 on wp-config.php. Of course it could be a plugin..

  • just create a wp-config.php and leave the wp-config-sample.php stay there
    – user145078
    Jun 3, 2019 at 17:47
  • Currently have both files exist. Are you suggesting that I update the wp-config-sample.php with my settings? I will try that.
    – Enkode
    Jun 3, 2019 at 17:54
  • No. Even if you have the wp-config-sample.php wordpress is not going to use it. wordpress only use wp-config.php
    – user145078
    Jun 3, 2019 at 18:21
  • 1
    @Enkode that actually may be a decent workaround for the time-being. I would populate wp-config-sample.php with the values from wp-config.php, that way, in the event that this happens again, your site won't break. I would also ask your host to see if there's been anything fishy going on - WordPress will use wp-config-sample.php as the config file if it can't find wp-config.php, and will try to load /wp-admin/setup-config.php to reconfigure the site (seen near the top of /wp-load.php).
    – phatskat
    Jun 3, 2019 at 19:14
  • Thanks I took that approach and deleted / re-installed the wp-includes / wp-admin folder as precaution. If it happens again I will run a couple of test sites. 1 with no plugins running and one on a different host to try and isolate the culprit
    – Enkode
    Jun 3, 2019 at 20:56


Your Answer

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

Browse other questions tagged or ask your own question.