Before upgrading backup your database, then use an FTP program to copy ALL the files in your WordPress directory to your hard drive. This way you don’t miss any important files, or backup just the files you believe are important, such as wp-config.php., .htaccess, themes directory, database backup file, etc.
WordPress comes with an automatic upgrade that sometimes hits a snag, causing you to start over, and it is recommended to deactivate all plugins before the upgrade. Not a good experience when you’re pressed for time, and don’t want any blog downtime.
With the directions below you will be able to upgrade WordPress in only two steps from a command line using either SSH or telnet.
Using the block of commands below you will not need to deactivate, then reactivate any plugins, there will be zero blog downtime, and there are no snags. The commands are setup to delete only the directories and files that will be upgraded, which leaves all of your other files intact. Simply change the username, password, and blog-directory to the appropriate pathway. Take note you will need to add an extra blank line after the last command to send the last carriage return so you won’t have to hit enter.
In the example below the rm -fR will work on Redhat 5, but on Redhat 4 you would need to use rm -rf. Check your operating system syntax to be sure the example below will work as expected. Always backup everything first to prevent a catastrophe.
cd /tmp
wget http://wordpress.org/latest.zip
unzip *.zip
cd wordpress
cd wp-content
cd themes
rm -fR *
cd ..
cd plugins
rm -fR *
cd ..
cd ..
cd ..
su username
password
cd /var/www/blog-directory
rm -fRv wp-admin
rm -fRv wp-includes
rm -fv index.php
rm -fv license.txt
rm -fv readme.html
rm -fv wp-app.php
rm -fv wp-atom.php
rm -fv wp-blog-header.php
rm -fv wp-comments-post.php
rm -fv wp-commentsrss2.php
rm -fv wp-config-sample.php
rm -fv wp-cron.php
rm -fv wp-feed.php
rm -fv wp-links-opml.php
rm -fv wp-load.php
rm -fv wp-login.php
rm -fv wp-mail.php
rm -fv wp-pass.php
rm -fv wp-rdf.php
rm -fv wp-register.php
rm -fv wp-rss2.php
rm -fv wp-rss.php
rm -fv wp-settings.php
rm -fv wp-trackback.php
rm -fv xmlrpc.php
cp -fvr /tmp/wordpress/* .
exit
cd /tmp
rm -fR /tmp/wordpress
rm -f /tmp/*.zip
If everything works as expected you can now upgrade WordPress in only two steps, copy and paste.
For those that cannot use telnet or SSH, WordPress has simple upgrade and more detailed upgrade instructions on their site.
We’ll cover upgrading WordPress via FTP in a different article.
WordPress has an automated upgrade script, as mentioned above, which only works if you use the FTP port 21. If you use a different port, you’ll need to change it using wp-config.php.
I do not recommend insecure telnet, but I do recommend SSH. A good Secure Shell program is SecureCRT, although it’s not free.
Leave a Reply