WordPress Update: Installation Failed / Could Not Copy Files

Nothing is more exciting than updating WordPress to the latest version that brings you not only enhancements, but also new features. And nothing is more nerve-racking and dejected when the update doesn’t go smoothly as it should.

I had this “Installation Failed” on 3 of my client websites when trying to update WordPress to 3.6.

The Symptom

wordpress-3.6-update-could-not-copy-files-installation-failed

The Cause

The reason WordPress can’t finish the update is improper file/folder ownership setting. 3 sites are all hosted on the same server by one company, and these sites were setup by a freelance developer who works as a reseller of some hosting company. The WordPress installation kept giving these permission related troubles in the past. It is time to have it fixed once for all.

The Solution

WordPress doesn’t need full ownership of its files & folder to work, but it indeed requires such to run automatic update, including theme, plugin & WordPress. The default installation done by WordPress should take care of everything. But during manual installation & migration, it is up to the site owner (or developer) to handle this properly.

The problem site’s default ownership is set as:

{site-owner}:www-data

In this case, should be changed to

www-date:www-data

by this command in Terminal.

chown -R www-data:www-data *

Make sure you run this at the root directory of the website.

You may find some other suggestions, such as changing file permission to 777. This is very dangerous and shouldn’t be considered. It is not the file permission that caused trouble but ownership.

3 thoughts

  1. When i try chown -R www-data:www-data * I get : chown: invalid user: `www-data:www-data’
    Any ideas what I might need to do?
    Thanks

    1. The command format is {user}:{group}. Apache runs as www-data in www-data group.

      I don’t know what kind of web server your site is hosted on. You need to get that info, and change the command accordingly.

Comments are closed.