Plugin Installation failed: Could not create directory

Keywords: WordPress - AWS - Technical issue - Permissions

bnsupport ID: 9bb82f8a-097e-9ea0-218a-f12a26038aea

bndiagnostic output:

? Apache: Found possible issues
? Wordpress: Found possible issues
? Resources: Found possible issues

bndiagnostic failure reason: The documentation did not make any significant change

Having some permission issues in my Lightsail instance.

I rsync’d plugin/theme files from a different install into this Lightsail one, so I think that may have been the problem?

I ran the suggested cmds:
sudo chown -R bitnami:daemon stack/wordpress
sudo find stack/wordpress -type d -exec chmod 775 {} \;
sudo find stack/wordpress -type f -exec chmod 664 {} \;

But still get the same error when trying to install/update any plugins. I’ve since removed(renamed) the entire plugins directory because I had a total “There has been a critical error on this site” message. Now, the admin is working and correctly shows no plugins installed, but I also can’t install any plugins—get the error in the subject Installation failed: Could not create directory

Any helps is much appreciated.

FYI, the Apache issue from the diagnostic tool specified a PHP error: PHP Warning: Creating default object from empty value in /opt/bitnami/wordpress/wp-admin/includes/post.php on line 736', and Cannot serve directory /opt/bitnami/wordpress/wp-admin/css/: No matching DirectoryIndex, but both seem unrelated (though I’m looking into fixes for both).

The Wordpress issue was Got error 'PHP message: WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO 'wp_actionscheduler_actions' which also seems unrelated, but looking for that fix elsewhere.

And finally, the Resources issue is that my instance has little available RAM memory(also unrelated), but it’s definitely been because I’m trying to install/update all these plugins. I’ll be looking to up the amount of RAM shortly.

All of these fixed, and I suppose the permissions would still be an issue.

Hi @davejmoz,

Thanks for using Bitnami. I checked your bndiagnostic bundle and I think the issue with the plugins is that there isn’t a wp-content/plugins directory on your installation. These are the folders found under the wp-content directory

total 40
drwxrwxr-x  9 bitnami daemon 4096 Oct 13 21:03 .
drwxrwxr-x  3 daemon  root   4096 Oct 12 23:41 ..
drwxrwxr-x  2 bitnami daemon 4096 Oct 13 14:05 ai1wm-backups
drwxrwxr-x  3 bitnami daemon 4096 Oct 13 14:42 ewww
-rw-rw-r--  1 bitnami daemon   28 Oct 12 23:41 index.php
drwxrwxr-x  2 bitnami daemon 4096 Oct 12 23:41 languages
drwxrwxr-x 37 bitnami daemon 4096 Oct 13 21:01 plugins-old
drwxrwxr-x  6 bitnami daemon 4096 Oct 12 23:43 themes
drwxrwxr-x  3 bitnami daemon 4096 Oct 13 21:08 upgrade
drwxrwxr-x 12 bitnami daemon 4096 Oct 13 15:04 uploads

As you see, there is a plugins-old directory, but not a plugin one. Can you copy plugins-old to plugins?

cp -r /opt/bitnami/wordpress/wp-content/plugins-old /opt/bitnami/wordpress/wp-content/plugins

Additionally, can you run the next commands on your server and share the information with us?

sudo ls -lart /bitnami
sudo ls -lart /bitnami/wordpress

Hey, thanks for your reply.

I had renamed /plugins to /plugins-old because I was getting the “There is a critical error on this website” message, and removing the plugins fixed it. I’ve now re-created the plugins folder, but still get the same error when trying to install a plugin via “Add New” in the WP Dashboard.

The output for the two commands you mentioned are:

total 20
drwxrwxr-x  3 root   root 4096 Oct  8 17:52 mariadb
drwxrwxr-x  2 daemon root 4096 Oct  8 17:53 phpmyadmin
drwxr-xr-x 19 root   root 4096 Oct 12 23:40 ..
drwxrwxr-x  3 daemon root 4096 Oct 12 23:41 wordpress
drwxr-xr-x  5 root   root 4096 Oct 12 23:41 .
-rw-r--r--  1 root   root    0 Oct 12 23:41 .initialized


total 20
-rw-r-----  1 bitnami daemon 4410 Oct 12 23:41 wp-config.php
drwxrwxr-x  3 daemon  root   4096 Oct 12 23:41 .
drwxr-xr-x  5 root    root   4096 Oct 12 23:41 ..
drwxrwxr-x 10 bitnami daemon 4096 Oct 14 14:20 wp-content

I guess maybe a good question for you is: it seems there are a bunch of different directories that contain Wordpress files. Am I in the correct place when I add a theme and plugins to /stack/wordpress/wp-content?


Hi @davejmoz,

Thanks for your message. Our installation has an internal symbolic link from /bitnami/wordpress/wp-content to /opt/bitnami/wordpress/wp-content, that’s why you see different folders with WordPress files, but they are the same.

Can you launch a fresh new instance and install the plugins one by one instead of migrating them using rsync? Can you also check if following the steps in the guide below about migrating WordPress data solves your issue in a new instance?

Apart from the above, can you also contact the plugins developers for more information on how to debug the installation issue?

Unfortunately, the All-in-one migration plugin has limits on the size of the upload unless you have a paid version, and the site I’m trying to migrate shows a 1GB file exported from the All-in-one plugin.

Installing each plugin one by one is not preferred because there are quite a few of them.

On top of these things, the uploads folder for the site I’m migrating has tons of files.

Is there no way to reset the permissions/owners on the existing install?

I ended up fixing this with a combination of using:

  • stat path/to/various/plugins/
    • to check current permissions, owners, and groups
  • sudo chown -R bitnami:daemon stack/wordpress
    • to set owner & group to the correct values
  • sudo find stack/wordpress -type d -exec chmod 775 {} \;
  • sudo find stack/wordpress -type f -exec chmod 664 {} \;
    • to set correct permissions on directories and files (I thought they were running recursively originally, but they were not)

Thanks for taking the time to look into this with me.

Also, using the WP > Tools > Site Health > Info > Filesystem Permissions tab was helpful.

I am Facing the same issue, I tried the above solutions, but i didn’t configure this problem please help me my site is here

EDITED: @gongomgra removed external link to avoid spam

Hi @davejmoz,

Thanks for your message and for sharing your solution regarding permissions. I’m glad your website is working now! we will close this thread as solved. Please do not hesitate to open a new one with any other questions you may have.

@rscproject.01, please run the bndiagnostic tool and open a new technical issue with the random code the tool will generate.