Skip to content

WordPress on Lightsail cannot install plugins - "Installation failed: Could not create directory"

0

Hi,

I am running WordPress on Amazon Lightsail using the Bitnami stack.

The WordPress installation path is: /opt/bitnami/wordpress

Currently, I cannot install any plugins from the WordPress dashboard. It always fails with this error: “Installation failed: Could not create directory.”

I believe this is related to file ownership/permissions in: /opt/bitnami/wordpress/wp-content/

Could someone please help me restore the default Bitnami permissions and ownership so WordPress can write to the plugins directory?

I am not comfortable running SSH commands by myself, so I would really appreciate your guidance or a safe fix.

Thank you!

asked 5 months ago145 views
1 Answer
1

This is a common issue with WordPress on Lightsail, particularly related to file permissions and ownership in the wp-content directory.

The error "Installation failed: Could not create directory" occurs because WordPress doesn't have the necessary permissions to write to the plugins directory. This is likely because the web server user (typically www-data or daemon) doesn't have write permissions to the wp-content directory.

To fix this issue, you'll need to modify the permissions of your wp-content directory. Here's how you can do it safely through SSH:

  1. Connect to your Lightsail instance using the browser-based SSH client from the Lightsail console.

  2. Run the following command to change the permissions of the wp-content directory and its contents:

chmod -R 775 /opt/bitnami/wordpress/wp-content

This command recursively (-R) changes the permissions of the wp-content directory and all files and subdirectories within it to 775, which allows the owner and group to read, write, and execute, and others to read and execute.

If this doesn't resolve the issue, you might also need to check if the destination directories for plugins exist and ensure they have the correct ownership. The Bitnami WordPress stack typically uses a specific user and group for file ownership.

After making these changes, try installing plugins again from your WordPress dashboard. The permission changes should allow WordPress to create directories and install plugins successfully.
Sources
Wordpress Site on AWS Lightsail LAMP instance is up HOWEVER, media upload attempts are met with "Unable to create directory wp-content/... Is its parent directory writable by the server?" How to fix?? | AWS re:Post

answered 5 months ago
  • I prefer to wait for a human expert answer to confirm the right commands, since I already had issues with permissions before.

  • The AI command is accurate. It is also correctable if it causes other issues. But I think some previous command must have put it in this state.

    If you run ls -ld -- /opt/bitnami/wordpress/wp-content/ you should see something like drwxrwxr-x 8 bitnami daemon 4096 Nov 18 16:35 /opt/bitnami/wordpress/wp-content/. The important fields here are drwxrwxr-x, bitnami, and daemon. If those three fields are correct, your instance should be good to go.

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.