Unable to create directory in wp-content/uploads in Wordpress

前端 未结 19 777
孤独总比滥情好
孤独总比滥情好 2020-12-29 02:20

I am not able to upload any images to the Media section. I get this error message:

\"Unable to create directory wp-content/uploads/2015/05. Is its par

相关标签:
19条回答
  • 2020-12-29 02:37

    I was having a similar problem after migrating from a development site to a production site. It turned out that the message is deceptive. Check Settings, Media. Verify the directory for media is accurate for the current site. If the site was migrated, the directory listed still be from the old site and may need to be updated.

    0 讨论(0)
  • 2020-12-29 02:40

    Debian like:

    chown -R www-data:www-data /var/www/{yourpath}/wp-content/uploads
    
    0 讨论(0)
  • 2020-12-29 02:41

    You may have to add a folder named uploads first before you change any permissions.

    My environment is xampp in Ubuntu 18.04 and the Wordpress installation failed to create the folder 'uploads'.

    cd into the wp-content directory.

    mkdir uploads

    while still in the wp-content path, use chmod 0777 to add the relevant permissions:

    sudo chmod 0777 uploads
    

    This worked for me.

    0 讨论(0)
  • 2020-12-29 02:45

    This is a solution when you are on your local but can be applied also on a server.

    Sometimes if you get a backup from the database that is on a server and you recover it on your local you will have this problem: "Unable to create directory..." even if you have the correct permissions on your folder. This happens because WP points to a value on upload_path on the database.

    So go to wp_options table.

    Search for upload_path and check if the path is correct.

    If not. (on mac and unix) Go to your upload folder, drag it to the terminal. And use pwd command copy the response on upload_path on the database.

    Hopefully this will help someone.

    0 讨论(0)
  • 2020-12-29 02:45

    This solution worked for me:

    chown -R www-data:www-data /path-to-mywordpress-root-folde
    
    0 讨论(0)
  • 2020-12-29 02:47

    I tried all the solutions from How to Fix the Unable to create directory Error in WordPress in my Centos7. But it won't work.

    Then I found some useful message in /var/log/audit/audit.log

    type=AVC msg=audit(1495357844.782:604): avc: denied { write } for pid=2721 comm="httpd" name="wp-content" dev="dm-5" ino=1074299184 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:etc_runtime_t:s0 tclass=dir type=SYSCALL msg=audit(1495357844.782:604): arch=c000003e syscall=83 success=no exit=-13 a0=7fffba9c62c0 a1=1ff a2=8 a3=5 items=0 ppid=1556 pid=2721 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)

    Check the file infomation : ls -Z /data/web/wordpress

    Found that SELinux prevented Httpd to access the files. So you can disable the SELinux, or modify the file context: chcon -R --type=httpd_sys_rw_content_t /data/web/wordpress . And it works.

    0 讨论(0)
提交回复
热议问题