{"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<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6ae9bf1c6c761\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #1a202c;color:#1a202c\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #1a202c;color:#1a202c\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6ae9bf1c6c761\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/11\/have-you-ever-upgraded-wordpress-wp-configphp\/#My_wp-configphp_File\" >My wp-config.php File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/11\/have-you-ever-upgraded-wordpress-wp-configphp\/#Latest_wp-configphp\" >Latest wp-config.php<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/11\/have-you-ever-upgraded-wordpress-wp-configphp\/#Changes_in_wp-configphp\" >Changes in wp-config.php<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/11\/have-you-ever-upgraded-wordpress-wp-configphp\/#Should_you_upgrade_wp-configphp\" >Should you upgrade wp-config.php?<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"My_wp-configphp_File\"><\/span>My wp-config.php File<span class=\"ez-toc-section-end\"><\/span><\/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><span class=\"ez-toc-section\" id=\"Latest_wp-configphp\"><\/span>Latest wp-config.php<span class=\"ez-toc-section-end\"><\/span><\/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><span class=\"ez-toc-section\" id=\"Changes_in_wp-configphp\"><\/span>Changes in wp-config.php<span class=\"ez-toc-section-end\"><\/span><\/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><span class=\"ez-toc-section\" id=\"Should_you_upgrade_wp-configphp\"><\/span>Should you upgrade wp-config.php?<span class=\"ez-toc-section-end\"><\/span><\/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}]}}