WordPress 4.7 version auto update to WordPress 4.7 likely to break website. Our step by step guide to fix WordPress 4.7 upgrade failed with Genesis and W3 Total Cache. It is really not for Shared Server users but they can modify steps. We do have guide to use limited SSH on some shared server. As you can see we are loading website, it was down for failed upgrade and took 1 hour to fix. Please follow our steps, if still site is not working, ask us on Twitter for free.
Why Situation Arising to Fix WordPress 4.7 Upgrade Failed?
It is commonly happening because Linux kernel is normally not allowing some files modification via PHP cURL or old cache, cookies from Nginx, WordPress W3TC etc are creating conflict. Database thankfully is not getting destroyed. HSTS (listed on HTTPS Everywhere List) can give additional odd situation. Commonest situation of WordPress 4.7 upgrade failed is that –
- You can login to wp-admin but it is white page.
- Frontend hardly has few stuffs but no text
- You clicked WordPress prompt to upgrade database
- Latest Genesis officially supports WordPress 4.7.
- W3TC has no official support
- WordPress has no paid official support
- Your server is unmanaged
- Peoples are waiting to suck your hard earned money
Steps Fix WordPress 4.7 Upgrade Failed (With Genesis, W3 Total Cache)
We are taking that your FTP root is at /usr/share/nginx/html/
, Nginx virtual hosts file is /etc/nginx/sites-available/default
on Ubuntu 16.04 LTS using PHP7, W3 Total Cache, Genesis theme frame works and common plugins we suggest to use and written on our setup. Funnily all plugins are compatible but upgrade throws error. Change location commands on your need. We suggest to use the default settings for many reasons. SSH to server. First thing is that, /etc/nginx/sites-available
must not have any W3TC related directions. Usually the directive will be wrapped with # BEGIN W3TC
like lines. Cut and paste them on separate directory’s new file like on location /etc/nginx/
as w3tc.conf
. You’ll later include the file from the main /etc/nginx/sites-available
file in this way :
---
1 | include /etc/nginx/w3tc.conf; |
If you need such change, do and restart Nginx :
1 2 | nginx -t service nginx restart |
Change directory to /usr/share/nginx/html/
:
1 | cd /usr/share/nginx/html/ |
Create two directories :
1 2 | mkdir /usr/share/nginx/html/new-wordpress mkdir /usr/share/nginx/html/old-wordpress |
We will rename (actually) few handpicked files, directories but will keep backup. Go to Plugins directory and deactivate all, do these steps even if you can not understand :
1 2 3 4 5 6 7 | cd /usr/share/nginx/html/wp-content mv plugins diabled-plugins mv cache disabled-cache mv db.php disabled-db.php mv object-cache.php disabled-object-cache.php cd /usr/share/nginx/html nano wp-config.php |
comment out or delete two lines related to W3 Total Cache on wp-config.php
, so that the file’s those lines look like this :
1 2 3 4 5 6 7 8 | ... /** Enable W3 Total Cache */ // define('WP_CACHE', true); // Added by W3 Total Cache ... /** Enable W3 Total Cache Edge Mode */ // define('W3TC_EDGE_MODE', true); // Added by W3 Total Cache ... require_once(ABSPATH . 'wp-settings.php'); |
Now we will move wp-admin
, wp-includes
and other files, delete few :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | cd /usr/share/nginx/html/wp-content mv plugins diabled-plugins mv cache disabled-cache mv db.php disabled-db.php mv object-cache.php disabled-object-cache.php rm -r /usr/share/nginx/html/wp-content/cache/page_enhanced rm -r /usr/share/nginx/html/wp-content/cache/object rm -r /usr/share/nginx/html/wp-content/cache/db rm -r /usr/share/nginx/html/wp-content/cache/minify cd /usr/share/nginx/html mv wp-admin diabled-wp-admin mv wp-includes disabled-wp-includes mv diabled-wp-admin old-wordpress mv disabled-wp-includes old-wordpress mv index.php license.txt wp-blog-header.php wp-load.php wp-signup.php wp-comments-post.php wp-login.php wp-trackback.php readme.html wp-cron.php wp-mail.php xmlrpc.php wp-activate.php wp-links-opml.php wp-settings.php old-wordpress/ ls old-wordpress |
You’ll see that old-wordpress
has your old files. Now we will prepare new WordPress :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | cd /usr/share/nginx/html/new-wordpress wget https://wordpress.org/latest.tar.gz tar -xzvf latest.tar.gz rm latest.tar.gz cd wordpress mv * .. cd .. rm -r wordpress rm wp-config-sample.php mv index.php license.txt wp-blog-header.php wp-load.php wp-signup.php wp-comments-post.php wp-login.php wp-trackback.php readme.html wp-cron.php wp-mail.php xmlrpc.php wp-activate.php wp-links-opml.php wp-settings.php .. mv wp-admin .. mv wp-includes .. cd /usr/share/nginx/html ls |
You’ll see that your FTP root has all new files. Now try to login via wp-login.php
webpage. You’ll be able to login. Still you may not see the frontend loading. You have to install the new default WordPress theme and active it. After activating, go to frontend, you’ll see that your website is now loading text. Now activate the latest Genesis base child theme (not your any custom child theme), you’ll see that your website is now loading text. Now activate the plugins :
1 2 3 | cd /usr/share/nginx/html/wp-content mv w3-total-cache disabled-w3-total-cache mv diabled-plugins plugins |
Plugins will get activated except W3 Total Cache. Activate your custom child theme. Go to frontend and WordPress will load fine. Exactly like it was. Use this W3 Total Cache in future :
1 | https://github.com/szepeviktor/fix-w3tc |
Everything is done. If all is fine you can delete the directories we used :
1 2 | rm -r /usr/share/nginx/html/new-wordpress rm -r /usr/share/nginx/html/old-wordpress |
You can change the WordPress security salt :
1 | curl -s https://api.wordpress.org/secret-key/1.1/salt/ |
You need to set the permission, ownership properly :
1 2 | sudo chown -R www-data:www-data /usr/share/nginx/html/ sudo find /usr/share/nginx/html -type d -exec chmod g+s {} \; |
Possibly all done.
Suggested Steps For the Next Time
We will suggest to use web hosts like Aruba Cloud (1 Euro/month for 1 GB RAM VMware instance) or VPSDime ($7/month for 6GB RAM OpenVZ instance) to clone the whole server before running upgrade. You can get reviews of others on Low End Box, Web Hosting Talk. They are far superior than Linode, DigitalOcean, Amazon. You need Dyn DNS or Hurricane Electric DNS with them. We have no affiliate links or affiliate like links are not for money making. We took a full FTP, Database backup before proceeding to fix. Most do not have latest backups, we have guide on using DropBox from SSH for pushing backups.
Tagged With w3tc 4 7 , w3tc nginx minify conf