When Your WordPress Upgrade Fails
To keep your WordPress blog secure and up-to-date, you want to apply the latest updates. When there's an update available, you see it at the top of your Dashboard area. To upgrade WordPress:
1. First back up your files. You should already have an automated backup strategy in place. Two backup plugins I like to use are WP-dbmanager and WordPress Database Backup. To install one of these plugins, to go Plugins > Add New, search for it, and then install, activate, and run it.
This backs up your database (which includes your posts, pages, comments, and settings). If you want to back up your theme as well, back up the folder under wp-content/themes.
2. After you back up your files, upgrade WordPress by going to Tools > Upgrade. Click Upgrade Automatically.
If you receive an error trying to upgrade, you can deactivate all your plugins to free up more memory, and then run the upgrade. It should work. Then reactivate your recently active plugins.
However, you can get around this problem in a more permanent way by increasing the memory in your php.ini file. The php.ini file includes settings for how php scripts run on your site. Increasing the memory settings in your php.ini file may also allow your plugins to run without error as well (for example, the Section Widget plugin required a lot of memory from my site and would corrupt the display on the Widgets page until I increased the memory limit in the php.ini file).
If you have cPanel on your web host, you can increase the memory of your php.ini file by doing the following:
- Under Software / Services, click PHP Config.
- Click the Install PHP.INI Master File button. This adds a default php.ini.default file in your public_html folder.
- Select the PHP 5 (Single php.ini) button at the top. This makes is so all your directories use the same php.ini file.
- Download the php.default.ini file and rename it to php.ini.
- In the file, change the following values to something like the numbers below:
- max_execution_time = 45
- max_input_time = 120
- memory_limit = 64M
While you're in there, also increase your upload_max_filesize number a bit (for example, to 25). This will allow you to upload an exported WordPress XML file (as well as larger images and other files) if you ever need to.
Now run the upgrade script again. It should work. If not, contact your web host to see if you have it installed and configured the php.ini file correctly.