Certified Wordpress Developer The wp_config.php file

The wp_config.php file
 


This is the configuration file that contains information blog needs in order to connect to database. This is where (or automated script) user have defined database name, username and password of the user to access that database. If something happens to that file – you will get error that WordPress is unable to connect to database.

The wp-config.php is the file contained in the root of your WordPress file directory which contains the login information for WordPress to connect to your MySQL database(s) as well as table prefix, secret keys, WordPress language and ABSPATH.

You can either:

  • Create and edit the wp-config.php file yourself,
  • Or skip this step and let WordPress try to do this itself when you run the installation script using the web interface. If you skip this step go to Using a FTP client to install WordPress

The safest way is to manually create your wp-config.php file following the instructions below as the installation script using the web interface doesn’t work for all server setups.

Downloading WordPress
1. Download the zip version of  WordPress from wordpress.org
2. Unzip the downloaded file to a folder on your hard drive.

Renaming the wp-config-sample.php file to wp-config.php
1.  Locate the wp-config-sample.php file within the wordpress folder inside the wordpress folder you unzipped.
2.  Rename wp-config-sample.php file to wp-config.php

Edit wp-config.php
The next step is you now need to edit your wp-config.php file for your installation.
You do this using a Text Editor program.

Tips for wp.config file

Back Up
Better safe than sorry: Back your content up, right now! Either use the built-in export page or use a plugin or back up from phpMyAdmin, but always have the power of undoing what you did while tweaking your website.

The operations could affect the database but they will not do anything with any of the files except the file we’re going to work with, so backing the wp-config.php file up is adequate… but if you haven’t backed up your files for more than a month, I suggest doing that too. Frequent backups are always good.

Disable the Revisions
The revisions feature for posts is enabled by default, but can lead to significant database bloat. Revisions are there so you can revert to a previous version of a post if you need to. If you don’t plan on using revisions to check the “earlier versions” of your posts, you definitely should disable this feature by adding the following line to the wp-config.php file:
    
define('WP_POST_REVISIONS', false );

 For Support