{"id":2680,"date":"2007-11-17T20:28:49","date_gmt":"2007-11-17T14:58:49","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/2007\/11\/have-you-ever-upgraded-wordpress-wp-configphp\/"},"modified":"2020-05-24T09:59:02","modified_gmt":"2020-05-24T04:29:02","slug":"have-you-ever-upgraded-wordpress-wp-configphp","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2007\/11\/have-you-ever-upgraded-wordpress-wp-configphp\/","title":{"rendered":"Should You Upgrade WordPress wp-config.php?"},"content":{"rendered":"<p>Whenever a new wordpress version is released, and we <a href=\"https:\/\/codex.wordpress.org\/Upgrading_WordPress_Extended\" rel=\"noopener\">upgrade wordpress<\/a>, there is <strong>one file we never upgrade: wp-config.php<\/strong> 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?<\/p>\n<p>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 <strong>wp-config-sample.php<\/strong> 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 <strong>MySQL database details<\/strong> 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.<\/p>\n<h3>My wp-config.php File<\/h3>\n<p>I realized I have never edited my wp-config.php since I moved from <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2006\/03\/starting-new-to-wordpress-initial-reactions\/\">Blogger to WordPress<\/a>. Here is what my code looks like since WordPress 1.5 a year and a half back (PHP Comments removed)<\/p>\n<pre><code>&lt;?php\r\ndefine('WP_CACHE', true);\r\ndefine('DB_NAME', 'putyourdbnamehere');\r\ndefine('DB_USER', 'usernamehere');\r\ndefine('DB_PASSWORD', 'yourpasswordhere');\r\ndefine('DB_HOST', 'localhost');\r\n$table_prefix  = 'wp_';\r\ndefine ('WPLANG', '');\r\n$server = DB_HOST;\r\n$loginsql = DB_USER;\r\n$passsql = DB_PASSWORD;\r\n$base = DB_NAME;\r\ndefine('ABSPATH', dirname(__FILE__).'\/');\r\nrequire_once(ABSPATH.'wp-settings.php');\r\n?&gt;<\/code><\/pre>\n<h3>Latest wp-config.php<\/h3>\n<p>Here is what the code in the latest wordpress version 2.3.1 looks like<\/p>\n<pre><code>&lt;?php\r\ndefine('DB_NAME', 'putyourdbnamehere');\r\ndefine('DB_USER', 'usernamehere');\r\ndefine('DB_PASSWORD', 'yourpasswordhere');\r\ndefine('DB_HOST', 'localhost');\r\ndefine('DB_CHARSET', 'utf8');\r\ndefine('DB_COLLATE', '');\r\n$table_prefix  = 'wp_';\r\ndefine ('WPLANG', '');\r\ndefine('ABSPATH', dirname(__FILE__).'\/');\r\nrequire_once(ABSPATH.'wp-settings.php');\r\n?&gt;<\/code><\/pre>\n<h3>Changes in wp-config.php<\/h3>\n<p>As you notice, 2 new tags have been added<\/p>\n<pre><code>define('DB_CHARSET', 'utf8');\r\ndefine('DB_COLLATE', '');<\/code><\/pre>\n<p>And the following have been removed<\/p>\n<pre><code>$server = DB_HOST;\r\n$loginsql = DB_USER;\r\n$passsql = DB_PASSWORD;\r\n$base = DB_NAME;<\/code><\/pre>\n<p>WP-Cache Manager added this as per comments (but I <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/10\/wp-cache-bug-strikes-back-site-down-17-hours\/\">do not use WP-cache<\/a>). I do not why it is still persisting.<\/p>\n<p><code>define('WP_CACHE', true);<\/code><\/p>\n<h3>Should you upgrade wp-config.php?<\/h3>\n<p>Since WordPress Version 2.2, <strong>DB_CHARSET<\/strong> 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. <strong>DB_COLLATE<\/strong> was made available to allow designation of the database collation (i.e. the sort order of the character set).<\/p>\n<p>I checked up more official information about <a href=\"https:\/\/codex.wordpress.org\/Editing_wp-config.php\" rel=\"noopener\">editing wp-config.php<\/a>, and was <strong><span style=\"color: #ff0000;\">lucky I did not upgrade<\/span> <\/strong>my wp-config.php as they give a warning that if DB_CHARSET and DB_COLLATE do not exist in your wp-config.php file, you should NOT add either definition to your wp-config.php file unless you read and understand <a href=\"https:\/\/codex.wordpress.org\/Converting_Database_Character_Sets\" rel=\"noopener\">Converting Database Character Sets<\/a>.<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whenever a new wordpress version is released, and we upgrade wordpress, there is one file we never upgrade: wp-config.php which&#8230;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6,7],"tags":[17],"class_list":["post-2680","post","type-post","status-publish","format-standard","hentry","category-blogging","category-security","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=2680"}],"version-history":[{"count":0,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2680\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=2680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=2680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=2680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}