WordPress.org

Forums

Wp-config keepd being reset (7 posts)

  1. jmcachran
    Member
    Posted 6 years ago #

    I have had a consistent problem on 2 blogs. My wp-config files keep getting reset to a file without any of the database and login information. When I try to go to the admin panel I get the "cannot connect to database" page, so I go and reset the information and it works again. Of course this is also causing my site to be down whenever the wp-config is reset.

    What could possibly be causing this and what can I do to stop it?

  2. whooami
    Member
    Posted 6 years ago #

    there isnt a lot that will cause that. wordpress will NOT do that.

    so its either some wierd plugin, or code elsewhere.. or its you, or its someone else with access to your files.

    you can kinda fix it if you have shell access to the box -- assuming its a *NIX flavored server, you can use the chattr ( chattr +i file) command to set the file as immutable (cant be written to by anyone but the owner).

    Again, the above assumes you have shell access, the server isnt running windows, and that you own the file.

    --

    If this is happening on shared hosting, I would be doing two things -- watching the ftp logs and checking them after its been changed (to see if someone is doing it via ftp) and watching the web server access logs (to see if someone is writing to the file via a script or backdoor)

  3. jmcachran
    Member
    Posted 6 years ago #

    I am still not sure how someone would be getting access, and it would be a pretty lame stunt. I even changed hosts (for an unrelated reason) and changed all the passwords and has still happened.

    Nothing at all shows on the logs. The only logins are mine.

    I am honestly at a loss. I have seen other people ask the same problem but can't find the posts now.

  4. whooami
    Member
    Posted 6 years ago #

    the only core file that would even come close to doing what you are describing is wp-admin/setup-config.php and I've tested it to see if its dumber than advertised and it's not (at least on my server)

    as long as it finds a wp-config.php, it wont do anything, even if there is a wp-config-sample.php in the same directory.

    even then, wp-admin/setup-config.php isnt going to truncate the file completely.

  5. jmcachran
    Member
    Posted 6 years ago #

    It happened again. Not sure what the deal is. Still nothing in the logs showing any access besides mine. And, honestly, why would someone go to the trouble to gain access to do nothing but this little stunt?

    I do know I have seen posts about the exact same thing happening before but cannot find them now. Just hope someone who remembers them notices this thread.

  6. jmcachran
    Member
    Posted 6 years ago #

    Well, I did a little experiment. I deleted the wp-config-sample from the folder and, lo and behold, the wp-config after a couple of days is suddenly blank. Something is changing the contents of wp-config to the contents of wp-config-sample.

    Any idea why?

  7. whooami
    Member
    Posted 6 years ago #

    delete wp-admin/setup-config.php off the server -- the file I already mentioned.

Topic Closed

This topic has been closed to new replies.

About this Topic