wordpress problem | Unable to create directory uploads/

March 18, 2015 6.6k views
Apache

I am having problems uploading a file into mu wordpress site

Receiving this error:
Before you can upload your import file, you will need to fix the following error:
Unable to create directory uploads/2015/03. Is its parent directory writable by the server?
ls -l /uploads
drwxrwsrwx 12 www-data www-pub 4096 Mar 18 11:51 uploads

root@ibaai:/var/www/wp-content/uploads/2015# ls -l
total 4
drwxrwsrwx 2 www-data www-data 4096 Mar 18 11:56 03

my process shows that www-data runs apache
/var/www/wp-content# ps aux | egrep apache
www-data 1829 0.0 10.6 330832 53616 ? S 11:48 0:01 /usr/sbin/apache2 -k start


www-data 1939 0.0 10.3 330552 51896 ? S 11:50 0:01 /usr/sbin/apache2 -k start

5 comments
  • I am working with ubuntu 14
    this is the output for stat
    root@ibaai:~# sudo stat /var/www/
    File: ‘/var/www/’
    Size: 4096 Blocks: 8 IO Block: 4096 directory
    Device: fd01h/64769d Inode: 394538 Links: 5
    Access: (2775/drwxrwsr-x) Uid: ( 33/www-data) Gid: ( 1001/ www-pub)
    Access: 2015-03-18 14:12:18.182119391 -0400
    Modify: 2015-03-17 14:49:51.014119391 -0400
    Change: 2015-03-18 14:12:10.458119391 -0400
    Birth: -
    root@ibaai:~# sudo stat /var/www/wp-content
    File: ‘/var/www/wp-content’
    Size: 4096 Blocks: 8 IO Block: 4096 directory
    Device: fd01h/64769d Inode: 398904 Links: 10
    Access: (2775/drwxrwsr-x) Uid: ( 33/www-data) Gid: ( 1001/ www-pub)
    Access: 2015-03-18 14:12:18.186119391 -0400
    Modify: 2015-03-18 14:07:49.846119391 -0400
    Change: 2015-03-18 14:12:10.458119391 -0400
    Birth: -
    root@ibaai:~# sudo stat /var/www/wp-content/uploads
    File: ‘/var/www/wp-content/uploads’
    Size: 4096 Blocks: 8 IO Block: 4096 directory
    Device: fd01h/64769d Inode: 393576 Links: 11
    Access: (2775/drwxrwsr-x) Uid: ( 33/www-data) Gid: ( 1001/ www-pub)
    Access: 2015-03-18 14:14:18.854119391 -0400
    Modify: 2015-03-18 14:14:18.370119391 -0400
    Change: 2015-03-18 14:14:18.370119391 -0400
    Birth: -

  • changed the group to www-pub
    www-pub:x:1001:www-data,user1
    But this doenst work

  • do:

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

    and

    sudo chmod -R 774 /var/www
    

    and then add your user to www-data group:

    sudo usermod -aG www-data $USER
    
  • The problem was not in the user rights but in the wordpress settings
    This was solved by adjusting the path in setting ->tools -> media

1 Answer

This question was answered by @winston770420:

The problem was not in the user rights but in the wordpress settings
This was solved by adjusting the path in setting ->tools -> media

View the original comment

Have another answer? Share your knowledge.