I never upgraded wordpress before because I’m afraid the upgrade may break existing functionalities of my site. So I always add the following line to wp-config.php:
define('AUTOMATIC_UPDATER_DISABLED', true );
AUTOMATIC_UPDATER_DISABLED will prevent wordpress site from upgrading itself automatically. The result is when I login wordpress back-end, I often see a reminder message:”wordpress new version is available, please upgrade”. Of course, I always ignore the upgrade reminder message and keep using the old version of wordpress. Thins went well until I upgraded php from version 5 to version 7(I hate the upgrade but a wordpress theme requires the new php version), my wordpress site stopped working. When I visited my site, I saw this message:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
The message is output in wp-includes/load.php by the function wp_check_php_mysql_versions. This function checks if the “mysql” php extension is loaded. In php 7 environment, this php extension is not loaded. Instead, it loads mysqli/mysqlnd. Do not try to bypass the mysql version check as the old wordpress uses functions like mysql_connect of mysql instead of mysqli_connect of mysqli as used in the latest version of wordpress. Since the mysql extenstion is deprecated in php7, the only solution to this problem is to upgrade wordpress to the latest version.
Now the situation is I cannot access my wordpress site, not to mention login to the admin panel to upgrade wordpress. How can I upgrade wordpress without logging in my site? I found this post that is very useful. Here is the step-by-step guide on how to upgrade wordpress manually.
- Login to your site in the old/working environment and disable all wordpress plugins.
- Download the latest wordpress, unzip to a folder.
- Copy the directories: wp-admin, wp-includes of the new wordpress to your site which will overwrite the old directories. Note that do not copy the wp-content directory, otherwise your current themes/plugins/uploads will be overwritten.
- Copy other files in the root directory of new wordpress into the root directory of your site. Until this time am I aware of why wordpress does not provide a wp-config.php but only wp-config-sample.php. That is just the consideration for upgrade. If wordpress ships with a wp-config.php, when you copy the files in the root directory, the current wp-config will be overwritten and the configuration information of your site will be lost.
- Visit http://domainhostseotool.com/wp-admin, you may see the following message asking you to update wordpress database if your old database is not consistent with the latest wordpress database:
Database Update Required
WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.
The database update process may take a little while, so please be patient.
Click the “Update WordPress Database” to update the database.
- Login to your site, you will see the following message asking you to update your email. Don’t panic, just click “The email is correct”, all will go fine.
Administration email verification
Please verify that the administration email for this website is still correct. Why is this important? (opens in a new tab)
Current administration email: firstname.lastname@example.org
This email may be different from your personal email address.
After upgrading, you might encounter other errors caused by your incompatible theme/plugins such as:
You need to correct these errors before the website can restore back to normal.