Every job comes with risk. Being a blogger isn’t an exception. Have you ever experience any malfunction in your blog, ranging from small inconvenience like how some features suddenly won’t load to big mess up that makes you unable to even login to your dashboard?

If you haven’t, then you probably haven’t done blogging for a long time. That, or you are a very lucky person.
Because, corrupt file issue in blogging is real, and it can be both annoying and damaging, and it can happen to anybody. Both newbie and expert may experience this unpleasant trouble.

One of the most frequent suspect for this glitch is corrupt wp-config.php file. Thankfully, fixing this corrupted file doesn’t require years of experience or college degree in programming. With some effort and willingness to learn, you can fix this wp-config corrupt file issue by yourself.

Here, we will share how you can do the fixing trick in WordPress.

What is wp-config corrupt file issue?

In WordPress, all files that make your website is saved in database. Corrupt file means there is file (or files) in the database that is broken, making you unable to retrieve or write it. One of the core is saved in a file named wp-config.php. If this file is corrupt, then it can cause major inconvenience. For example, when you try to load a page on your blog, instead of getting a prettily designed page with quality content, you get error message with various wordings:

  • There was an error
  • Cannot establish database connection
  • Sorry, your request cannot be completed
    Of course, this disturb your business. You can’t get your customers and they can’t get what they want. But, worry no more, because here we’ve collected three solutions for you to fix wp-config corrupt file.

1st Solution: Restore from a Back Up

Whoever you ask first for the solution will always recommend to restore the site from previous back up. It’s because this solution is the easiest among the others. That’s the advantage of this solution. The disadvantage, of course, is that you need to already have the back up.

If you happen to read this article as preventive measure and your blog is not actually corrupted right now, then we advise you to back up your blog right now. There are WordPress plugins that provides easy back up such as BackupBuddy and UpdraftPlus. You can even find free backup plugin like BackWPUp.

Using plug in like this, all you need to do to back up is enter your dashboard, go to your plugin, and set the backup preference. When you encounter corrupt file at some point, just open the plugin and restore the setting to the latest back up point using several click.

But, what if you don’t have any back up ready to restore? Or what if the corrupt file preventing you from logging in and accessing your dashboard? Then, you’ll want to check the 2nd solution below.

2nd Solution: Fix the Database

For the 2nd and 3rd solution, you must already have FTP (File Transfer Protocol) client installed in your computer, since we’ll be using them to access the database for your WordPress. There are many FTP client available out there. The most popular are FileZilla and SmartFTP but feel free to use any FTP client you prefer.

Once you’ve set up the FTP client with your website, you’ll be able to access the database. Go to your website’s root directory, and find a file named wp-config.php. Right click on the file and choose option to View/Edit.

Now, your default text editor will open a page full of source code of your website. You’ll want to scroll down without changing anything until you hit the last line, usually read That’s all, stop editing. Happy blogging!

Above that last line, paste this code below:

define( ‘WP_ALLOW_REPAIR’, true );

Now, save and exit the text editor. Go to your browser and try to access your website by typing http://yourwebsite.com/wp-admin/maint/repair.php. Of course, change yourwebsite with your own domain.

Press enter and WordPress will lead you to a page with two options: Repair Database and Repair and Optimize Database.

Click Repair Database and wait while the service is performed by WordPress. When the repair is finished, go back to your browser and access your blog as usual. This time, you’re supposed to be able to get your blog back.

Once the blog is alright, go back to the wp-config via FTP and remove the line you’ve previously added.

But… if this method still doesn’t work, then maybe you want to try the last chance.

3rd Solution: Replace the Core File

Again, this method will use FTP client active in your computer. It sounds rather scary to replace anything in the code-filled database we glimpsed earlier, but it really is not.

All you need to do is to head to WordPress.org and download the newest WordPress software. Unzip it to your computer and open it.

Now open the directory from FTP client. From it, find the location of WordPress root folder. Then, select all the files in your local directory and upload them. Some people suggest not to touch anything in wp-content folder however, in order to avoid losing all media you’ve previously uploaded into the device.

Finally, when the upload finished, then the core file in your database will be as newest as they can be, including the wp-config file that was previously corrupted.

There, now you don’t have to panic anymore if you encounter glitch during your career as a blogging. It’s perfectly natural to get once or twice with this annoying configuration problem, but they are many solutions for that, and we’ve covered three of the hardest trick above. So, sleep tight tonight, next time your website is acting up because of wp-config corrupt file, you’ll know exactly what action to take…