Articles in this section

WordPress update fails with: The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

When updating WordPress instance or plugins via WP Toolkit, the operation fails with one of the following messages:

PLESK_WARN: The WordPress installations were updated with errors: Installation "example": The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.

PLESK_ERROR: Unable to update WordPress core, details: PHP Warning: copy(/var/www/vhosts/example.com/httpdocs/wp-admin/includes/update-core.php): Failed to open stream: Permission denied in /var/www/vhosts/example.com/httpdocs/wp-admin/includes/class-wp-filesystem-direct.php <...>

Cause

Some WordPress files and directories have incorrect ownership.

For proper operation, all files should have 644 permissions on files and 755 on directories. Subscription's system user must be the owner of all files and directories.

Resolution

  1. Connect to your Plesk server via SSH.
  2. Repair permissions of files and directories inside the subscription:

    # plesk repair fs example.com -y

  3. Retry the previously failed operation in WP Toolkit.
  4. In case it fails, set correct permissions on all files and directories manually:

    In the command below, replace example.com/httpdocs with an actual path to a WordPress installation:

    Note: Custom permissions will be overwritten.

    # find /var/www/vhosts/example.com/httpdocs -type f -exec chmod 644 {} \;
    # find /var/www/vhosts/example.com/httpdocs -type d -exec chmod 755 {} \;

  5. Find the System User name of the domain. In the command below, replace example.com with an affected domain name:

    # plesk db "select d.Name as 'Domain Name', su.Login as 'System User' from sys_users su, hosting h, domains d where h.sys_user_id=su.id and h.dom_id=d.id and d.name='example.com';"

    +-------------+-------------+
    | Domain Name | System User |
    +-------------+-------------+
    | example.org | john_doe    |
    +-------------+-------------+

  6. Set the correct system user on all affected files and directories. In the command below, replace john_doe with the System User name from step 5:

    # chown -R john_doe:psacln /var/www/vhosts/example.com/httpdocs

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.