Unable to update Wordpress on Lightsail

0

Hi Team,

i have successfully built a Wordpress site on a personal Lightsail account, and post development i was able to package it and the DB, and setup it up on a new instance on the clients AWS account and transferred all the files and the db, the site works completely fine.

Except i am unable to update the Wordpress core. I have tried updating the file permissions and nothing has worked, the error i get is "The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php"

What i doubt is the problem is with the user role that triggers the update or the write access to these folders, so i tried to do the update through the wp-cli and i got the same error, even though i ran it sudo.

all the files have the permission of 664/644 and dir 775/755. and the file ownership is bitnami:daemon.

The plugin/theme updates are working fine, the media uploads without an issues, only the core update im having an issue.

I will put out a short decription on how to move from lightsail to another account based lightsail, once i can rectify this.

Regards, Shiva

1 Answer
0

The error message you're encountering suggests that WordPress does not have the necessary permissions to overwrite core files during an update. Even though you've set the permissions to 664/644 for files and 775/755 for directories, the issue may indeed stem from ownership or special permissions required for core updates. Here's what you can do:

  1. Check Ownership: The bitnami:daemon ownership is typical for Bitnami stacks, where bitnami is the user and daemon is the group. WordPress needs to be able to write to these files, which is typically allowed if the files are owned by the user under which the web server is running.

    For a Bitnami stack, you might want to ensure that the files you're attempting to update are owned by the daemon group. You can change the group ownership with:

    sudo chown -R bitnami:daemon /opt/bitnami/wordpress

    And then ensure that the group has write permissions:

    sudo find /opt/bitnami/wordpress -type d -exec chmod 775 {} \;
    sudo find /opt/bitnami/wordpress -type f -exec chmod 664 {} \;
  2. WP-CLI: Since running wp-cli with sudo didn't resolve the issue, it's likely not a straightforward permission problem. However, you can try to manually update WordPress core with WP-CLI to see if it gives more detailed output:

    sudo wp core update --path=/opt/bitnami/wordpress --allow-root
  3. Check Security Plugins: If you have security plugins installed, they might be preventing the changes. Temporarily disable them and try updating again.

  4. Filesystem Method: Ensure that the FS_METHOD in your wp-config.php is not set to ftpext which requires FTP credentials to update. For local filesystem method, it should not be defined or set as direct.

    define('FS_METHOD', 'direct');
  5. Temporary Files: Ensure that WordPress can manage temporary files during the update. You might need to specify a temporary directory that WordPress can write to in wp-config.php:

    define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');

    Before adding this line, create the temp directory within wp-content and give it the correct permissions:

    mkdir /opt/bitnami/wordpress/wp-content/temp
    sudo chown bitnami:daemon /opt/bitnami/wordpress/wp-content/temp
    sudo chmod 775 /opt/bitnami/wordpress/wp-content/temp
  6. Manual Update: If all else fails, you can always manually update WordPress by downloading the latest version and copying it over the existing files. This is a more hands-on approach and should be done with care to not overwrite customizations.

Remember to backup your site before making changes, so you can restore it if something goes wrong. Also, consider doing such updates during a low-traffic period to minimize the impact on your users.

profile pictureAWS
Obijan
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions