WordPress Upgrade Failed: Could not copy fileLast updated on November 26th, 2023
Obviously I like to keep WordPress up-to-date to ensure it has the latest security patches, and that any new features, or improvements are available to myself, and you lovely readers!
Well of late I’ve had issues upgrading WordPress. I’ve tried the automatic upgrade on several occasions, but it continues to give me an “Installation Failed” error message.
It’s clear that this is permission based, as WordPress kindly points to the file its just taken ages downloading (the updated version of WordPress) and says it can’t copy the file (locally, as it’s already successfully downloaded it to our server). So what’s the issue?
Well I’ve tried a lot of the tricks suggested on the Internet, and I’ve also tried getting very cross with it… it turns out the below fixed it for me, so hopefully it might work for others:
– Simply goto the root directory of your blog by FTP or SSH, and make sure the permissions on your wp-config.php file are set to 0644. Switch the permissions back as soon as you’ve done the upgrade (you must change the permissions back to their original setting as 0644 gives the public access to your config file, which contains your databbase username and password for WordPress).
To minimise any security risk while doing the above, it is worth adding the below to your .htaccess file in the blog root directory. This will prevent people accessing your wp-config.php file while you are doing the upgrade.
deny from all