November 17th, 2007
Should You Upgrade Wordpress wp-config.php?
Whenever a new wordpress version is released, and we upgrade wordpress, there is one file we never upgrade: wp-config.php which has the MySQL database details. Have you ever looked up how this file has changed over the year? Have you ever upgraded wp-config.php?
wp-config.php is a very important file that defines the WordPress configuration settings required to access your MySQL database. The new wordpress download always provides a wp-config-sample.php so that you do not overwrite the precious wp-config.php file by mistake and end up with MySQL database errors. New wordpress users need to fill in the MySQL database details and rename the file to make wordpress work. Though I keep my core wordpress and its plugins updated, I thought what if wp-config.php had undergone a change over these years and had a security hole accessible to hackers.
My wp-config.php File
I realized I have never edited my wp-config.php since I moved from Blogger to Wordpress. Here is what my code looks like since Wordpress 1.5 a year and a half back (PHP Comments removed)
<?php
define('WP_CACHE', true);
define('DB_NAME', 'putyourdbnamehere');
define('DB_USER', 'usernamehere');
define('DB_PASSWORD', 'yourpasswordhere');
define('DB_HOST', 'localhost');
$table_prefix = 'wp_';
define ('WPLANG', '');
$server = DB_HOST;
$loginsql = DB_USER;
$passsql = DB_PASSWORD;
$base = DB_NAME;
define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
?>
Latest wp-config.php
Here is what the code in the latest wordpress version 2.3.1 looks like
<?php
define('DB_NAME', 'putyourdbnamehere');
define('DB_USER', 'usernamehere');
define('DB_PASSWORD', 'yourpasswordhere');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
$table_prefix = 'wp_';
define ('WPLANG', '');
define('ABSPATH', dirname(__FILE__).'/');
require_once(ABSPATH.'wp-settings.php');
?>
Changes in wp-config.php
As you notice, 2 new tags have been added
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
And the following have been removed
$server = DB_HOST;
$loginsql = DB_USER;
$passsql = DB_PASSWORD;
$base = DB_NAME;
WP-Cache Manager added this as per comments (but I do not use WP-cache). I do not why it is still persisting.
define('WP_CACHE', true);
Should you upgrade wp-config.php?
Since WordPress Version 2.2, DB_CHARSET was made available to allow designation of the database character set (e.g. tis620 for TIS620 Thai) to be used when defining the MySQL database tables. DB_COLLATE was made available to allow designation of the database collation (i.e. the sort order of the character set).
I checked up more official information about editing wp-config.php, and was lucky I did not upgrade my wp-config.php
“Warning for those performing upgrades: If DB_CHARSET and DB_COLLATE do not exist in your wp-config.php file, DO NOT add either definition to your wp-config.php file unless you read and understand Converting Database Character Sets. Adding DB_CHARSET and DB_COLLATE to the wp-config.php file, for an existing blog, can cause problems — as Ryan Boren says, “your queries will go boom!”
After that advice, it seems best to not upgrade my wp-config and let it stay as it is. At least it is working well right now, and not much has changed anyway.
Save to Del.icio.us
If you like this post, then please subscribe to my full text RSS feed. You can also subscribe by email and have new posts sent to your inbox.
Read more
WordPress 2.0.5 Ronan Upgrade Available
Upgrade to Wordpress 2.0.5 Now : Essential Security Fixes
Preview Wordpress 2.0.5 RC1 Release Candidates
WordPress 2.0.6 Beta 1 for WP-Testers
Edit Feed-rss2.php to Customize Feeds in Wordpress





Comments
RSS feed for comments on this post.1. Thilak | 17/11/07 #
After reading the title of this post on Google Reader, I though of upgrading. Thank god, I read the complete post.
2. Manas | 17/11/07 #
You had almost got me to upgrade to wp-config.php.
3. QuickOnlineTips | 17/11/07 #
I just made “I did not upgrade” into red color. That should help those who skipped the details.
4. Matt | 18/11/07 #
I’ve upgraded it when I switched to WP 2.3 but I commented out the 2 new tags as they caused the UTF8 characters to display very funky.
5. topblogposts | 18/11/07 #
I am going to upgrade my wordpress to version 2.3 after that I will upgrade my wp-config file .
thanks for the informations .
6. QuickOnlineTips | 18/11/07 #
topblogposts - you are not supposed to upgrade if your wp-config is very old or you will get errors.
7. Pat Walsh | 21/11/07 #
too late but I did upgrade my wp-config.php wordpress config file and I had to restore. what a pain. Wish I had have read this forum earlier.
Pat
8. Do Not Upgrade Your WordPress wp-config.php | 20/11/07
9. WordPress Wednesday News: WordCamp Melbourne Sold Out Success, WordPress 2.4 Delayed, Security News, Rumors and Scams, and More : The Blog Herald | 21/11/07
Comment on “Should You Upgrade Wordpress wp-config.php?”