4. Editing your WordPress wp-config File
In this document, we will look at how to edit your wp-config file. This is the file that provides WordPress with important information such as database login information, secure tokens, and WP_DEBUG.
4.1 Editing wp-configLink to chapter 1
Now that you have set up your MySQL database and username you need to decide how you want to create your wp-config.php file for your WordPress installation.
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 Installing WordPress using FTP.
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.
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. Right click on wp-config-sample.php file, view Properties, and rename to wp-config.php
Edit your wp-config.php
You now need to edit your wp-config.php file for your installation.
You should do this using a Text Editor program such as EditPlus. EditPlus is a text editor, HTML editor and programmer’s editor for Windows. While you could edit in NotePad, EditPlus offers many powerful features that make it better suited for editing PHP.
For Mac Users try:
- Smultron – Text Edit software for purchase designed for MacOS Sierra 10.12 or later.
- Textmate – Text Edit software for purchase designed for Macs – very good and better suited to text editing
- You must use a text editor program which edits files in plain text format as non-text based word processing program such as Microsoft Word can cause major problems to code when used to edit PHP files.
You use EditPlus3 as follows to edit your wp-config.php file:
1. Download and install EditPlus3.
2. Locate your wp-config.php file on your hard drive.
3. Right mouse click on your wp-config.php file and select EditPlus 3 to open your wp-config.php file for editing using EditPlus 3.
4. Change the wp-config.php file for your installation by adding:
- Your database name
- Your username used to access the database
- Your password used to access your Database
- The host name of your database server — the host name is usually localhost but if concerned you can confirm by contacting or searching your hosting company’s online documentation.
These are all the details that you set up when you created your MySQL database and user.
5. Go to the WordPress secret key generator to grab authentication unique keys and salts then add them to your wp-config.php file.
- These values can be anything you want them to be — it is just easier to auto-generate them using the key generator
- These values help WordPress operate securely
6. Finally, save all changes to your wp-config.php file and close EditPlus3.
Example wp-config.php File
This is an example of what your wp-config.php file will look like. Don’t forget to fill in all values with your own.