Whenever there’s a new version of WordPress out (which should always be installed for security reasons – (WordPress 3.4.2 is out today!)) or a new version of your WordPress website’s theme or plugins is released, you’ll often want to upgrade from within WordPress without having to download, FTP, upload and install each new version.
Luckily for you, there’s a Graphical User Interface (GUI) for just this process built into WordPress.
However, this process, left unaltered, still requires for your to enter your FTP credentials (FTP address, username, and password) for each update you run.
Isn’t there an easier way?
Yes, there is, you can set up Direct updates, which run on the click of a button, using the following system.
Set Up Direct Plugin / Theme / WordPress Version Updates
Add the following code to your wp-config.php file:
That could easily be all you need to do – try Upgrading your WP version or a plugin.
What If It Doesn’t Work?
If, when you go to perform an upgrade, this still does not work, then your web server does not have sufficient “permissions” to perform the file moves, and deletions, necessary to upgrade the plugin / theme / WP version you’re trying to get it to alter.
On most WordPress setups (LAMP setups at least) the “user” running php will be “apache”. You need to make “apache” able to change the files.
To do this, you’ll need to SSH into the server and enter the folder above your webroot (in this case, the web root is “httpdocs”), and run the following command:
chown -R apache httpdocs
This will allow user “apache” to be “owner” of the whole lot of files in question (the -R tells the above command to recurse into directories).
What if it STILL Doesn’t Work?
If you’re still not working, you may have more restrictive files permissions which do not allow this. Maybe just use FTP for this!
It might be, if you are on shared hosting, that you’re not able to get this working. This is not a bad thing, as it means your host has hardened the server your website is sharing to some degree.
Things to be Aware Of
Note that, having changed the owner of the files to “apache” you might experience one or two permissions issues when FTP’ing from non root users.
Also note that, having allowed Apache to do whatever it likes with your files, anyone who gained your admin password to WordPress would be able to do a LOT. You should think about changing things back after the update, or, at the very least (though you should anyway) performing regular backups to recover from any sort of hijacking or break-in!
Can’t Someone Else Do This?
At Silicon Dales, on our Business and Enterprise maintenance contracts, we provide all routine maintenance for our clients. If you have a WordPress website the updating and management of which you’d like to offload to someone else, just contact us to request this.
Any problems with any of the above – or just to say “that worked!” – leave a public comment below!