BTR Naidu
BTR Naidu

Reputation: 1101

Wordpress upgrade to 4.4.2 failed

My setup:

OS: CentOS 7.1
http user: apache
http group: apache

When i perform automatic update, I get below error:

Downloading update from https://downloads.wordpress.org/release/wordpress-4.4.2-new-bundled.zip

Unpacking the update…

The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Installation Failed

I have tried upgrade with full permission but no luck:

#find . -type f -exec chmod 666 {} \;
#find . -type d -exec chmod 777 {} \;

Anyone has any clues? I searched for hours but no luck.

Upvotes: 0

Views: 1097

Answers (3)

John Smith
John Smith

Reputation: 487

Do Not use 777 permission! Wordpress only need 755 for directories, 644 for files, and 666 for themes and plugins directories & files. And you could give 600 to wp-config.php for security. You can see Wordpress documentation for file permission

I had this problem, and this is how I solved the issues.

  • Make sure all owned by Apache.
    sudo chown -R apache:apache /var/www/html/sitedir

  • Give proper permissions
    sudo find /var/www/html/sitedir -type d -exec chmod 755 {} +
    that would give 755 permission to all directory inside sitedir
    sudo find /var/www/html/sitedir -type f -exec chmod 644 {} +
    that would give 644 to all files
    sudo find /var/www/html/sitedir/wp-content/themes -type f -exec chmod 666 {} +
    sudo find /var/www/html/sitedir/wp-content/plugins -type f -exec chmod 666 {} +
    those two commands above make 666 permission to all files inside themes and plugins directory

  • If you use selinux
    sudo chcon -R system_u:object_r:httpd_sys_content_t:s0 /var/www/html/sitedir
    sudo chcon -R system_u:object_r:httpd_sys_rw_content_t:s0 /var/www/html/sitedir/wp-content
    Two commands above would change the context of your files and directories. And restart php-fpm if you use one.

    UPDATE:
    If you don't get through until this point. You might also need to set a local policy module for selinux. sudo grep php-fpm /var/log/audit/audit.log | audit2allow -M mypol
    sudo semodule -i mypol.pp
    Then restart php-fpm.

I also cover this Wordpress permission issue more detail on my blog :)

Upvotes: 1

BTR Naidu
BTR Naidu

Reputation: 1101

I ended up upgrading manually which worked smoothly.

Upvotes: 0

Tdelang
Tdelang

Reputation: 1308

Sometimes some (security) plugins seem to interfere with updating older versions of WordPress. Try deactivating plugins and trying again.

If all else fails, just perform a manual update via FTP.

Upvotes: 0

Related Questions