Wordpress can't create directory

June 11, 2014 18.2k views
After trying to figure out how to get my FTP to work, I ran into other problems concerning Wordpress. I ran Wordpress on Ubuntu 14.04 fine and it worked until I started messing the the FTP, but now I can't seem to be able to load in plugins because it doesn't have the permissions to do it. Since I didn't install Wordpress myself, I don't know which FTP account it was configured to use and I'm not quite sure how to go about fixing this. Could anyone help me out with this? I'm not too well versed in Ubuntu.
1 comment
  • Am using Centos7 and the folder owner is set to apache:apache
    I've done the below too, but i still get the error.

    find /var/www/wp -type d -exec chmod 755 {} \;
    find /var/www/wp -type f -exec chmod 644 {} \;
    

    and also added this to wp-config.php

    define('FSMETHOD', 'direct');
    

    but still i am getting an error, "Could not create directory". I can't update wordpress and can't update plugins.
    what am i missing here?

3 Answers
How are you trying to upload the plugins? Are you using a local FTP client like Filezilla or are you using a Wordpress FTP plugin? The plugins folder should be owned by the www-data user. You can make sure it is by running:
sudo chown -R www-data:www-data  /var/www/wp-content/plugins/
I'm use script with these command.
chown -R www-data:www-data /var/www
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;
If you store website's files other locations than /var/www/ just correct to right path :)

I have had the same issue, and after reading the multitude of responses I adopted solutions from all the sources and what finally worked for me was to:

add
define('FSMETHOD', 'direct');
putenv('TMPDIR='.ini
get('uploadstmp_dir')); to the wp-config.php file

then I created a wp-content/upgrade directory

then changed ownership : chown -R :www-data * from within wp-content folder.

Everything seems to work now.

Have another answer? Share your knowledge.