File could not be moved - WordPress

January 27, 2015 6.3k views

Hello,

I'm having problems to set permissions to WordPress' upload path. I always get this message: "Uploaded file could not be moved to wp-content/uploads".

Nginx and php-fpm are running under www-data user. Here is my ls -la output from /var/www/html folder:

drwxrwxr-x 8 www-data www-data 4096 Nov 20 14:25 .
drwxrwxr-x 5 www-data www-data 4096 Jan 26 20:41 ..
-rwxrwxr-x 1 www-data www-data 28 Jan 8 2012 index.php
drwxrwxr-x 4 www-data www-data 4096 Aug 6 16:16 languages
drwxrwxr-x 7 www-data www-data 4096 Jan 18 13:40 plugins
drwxrwxr-x 7 www-data www-data 4096 Jan 18 13:40 themes
drwxrwxr-x 2 www-data www-data 4096 Nov 20 14:25 upgrade
drwxrwxr-x 5 www-data www-data 4096 Jan 1 23:57 uploads

What possibiliy can be wrong?

Thanks,
Vinícius

4 comments
  • have you tried this:

    sudo chown -R www-data:www-data /var/www/html
    

    and then:

    sudo chmod -R 774 /var/www/html
    
  • Tried this with no success. :/

    Nothing relevant in the logs either...

  • Hmm..Are you sure your website is located in /var/www/html

    Could it be in another location, even /var/www

    You could try this to be sure:

    sudo chown -R www-data:www-data /var/www/
    
    sudo chmod -R 774 /var/www/
    
  • OMG, you nailed it. My root path is the default /usr/share/nginx/html.

    I was pretty sure I've changed that. Such a noob mistake.

    Thank you a lot!

1 Answer

This question was answered by @sierracircle:

Hmm..Are you sure your website is located in /var/www/html

Could it be in another location, even /var/www

You could try this to be sure:

sudo chown -R www-data:www-data /var/www/
sudo chmod -R 774 /var/www/

View the original comment

Have another answer? Share your knowledge.