Unable to create directory wp-content/uploads/. Is its parent directory writable by the server?

Q: Date/Time this occurred (Provide your time zone also)
A: Monday, February 8th, 2021 @ 7:46PM MST

Q: DevKinsta Version
A: Latest as of today

Q: OS Version
A: Windows 10

Q: Docker Desktop Version
A: v20.10.2

Q: Were any error codes or messages observed? If so, what were they?
A: Unable to create directory wp-content/uploads/2021/02. Is its parent directory writable by the server?

Q: Detailed Description of the Problem
A: Unable to upload image to DevKinsta post featured image or media library.

Hi @aidenberzins . Welcome! Thanks for reporting the issue. It should work by default :thinking: . Is this for a brand new site or an imported site? Do you have any other sites you’d be able to test this on? Lastly, do you have any apps or antivirus software that could be blocking it?

The site was originally imported from GoDaddy but I had someone restart the staging site so that I could develop fresh and pull into DevKinsta without issue.

I can try on one of my other sites as well to see if this is an isolated issue. It is only a problem because it rewrites the database with null values so if I could just push the site without the database that would also be fine.

No antivirus software.

@michael It is the same issue across my sites in DevKinsta.

Even if the folder already exists.

I did manage to figure it out.

I needed to restart the Docker DB container: “devkinsta_db” from Docker Desktop.
And then it had no issues.

1 Like

That’s fantastic! I’m glad it was an easy fix. Thanks for updating us here!

This does seem to be a recurring issue and resetting the DB container did not work this time.
Not sure how to troubleshoot this.

Hi Aiden,

Can you confirm that your wp-config file does not have any of the following set?

DISALLOW_FILE_EDIT
WP_TEMP_DIR

Nope,

Neither of those are in the wp-config file.

Sorry for the trouble. Could you clarify whether this occurs on a brand new empty site within DevKinsta?

All three sites were imported from Kinsta.
It doesn’t just seem to be occuring with images though. It also will not add plugins.

Thank you. Could you try creating a “New WordPress site” from within DevKinsta and testing the new blank site? As in, one that’s created from within DevKinsta and not imported. I’m curious if perhaps it’s a setting from those imported sites or a system issue.

It does seem to be working with the new site that was created from a clean install.

Thanks for testing that. Are you familiar with using Terminal? Could you try the following steps?

Run the following:

docker exec -it devkinsta_fpm bash

Then run this:

echo "IyEvYmluL2Jhc2gKCmZpbGVzPSh3cC1hZG1pbiB3cC1jb250ZW50IHdwLWluY2x1ZGVzKQplY2hvICJSZXNldHRpbmcgZmlsZSBwZXJtaXNzaW9ucywgdGhpcyBtYXkgdGFrZSBhIG1vbWVudC4uLiIKZWNobyAiUmVzZXR0aW5nIG93bmVyc2hpcC4uLiI7CmNob3duIHd3dy1kYXRhOnd3dy1kYXRhIC1SIC93d3cva2luc3RhL3B1YmxpYy8qCgpmb3IgaSBpbiAiJHtmaWxlc1tAXX0iCmRvCiAgZWNobyAiUmVjdXJzaXZlbHkgc2V0dGluZyBwZXJtaXNzaW9ucyB0byA2NDQgb24gJGkuLi4iOwogIGZpbmQgL3d3dy9raW5zdGEvcHVibGljIC10eXBlIGQgLW5hbWUgJGkgLWV4ZWMgY2htb2QgLVIgNjQ0IHt9ICsKZG9uZQplY2hvICJQZXJtaXNzaW9ucyBoYXZlIGJlZW4gcmVzZXQuIjsK" | base64 -d | bash

To translate, this will reset permissions. Here’s whats going on above:

#!/bin/bash
files=(wp-admin wp-content wp-includes)
echo "Resetting file permissions, this may take a moment..."
echo "Resetting ownership...";
chown www-data:www-data -R /www/kinsta/public/*
for i in "${files[@]}"
do
  echo "Recursively setting permissions to 644 on $i...";
  find /www/kinsta/public -type d -name $i -exec chmod -R 644 {} +
done
echo "Permissions have been reset.";

Let me know if that works for you!