Wordpress can't create directory

June 11, 2014 34.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?

4 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.

  • I tried this fix because I am using Ubuntu 16.04 as well. I have it in /var/www.html/blog and I performed the sudo find . -type f -exec chmod 0644 {} + and find . -type d -exec chmod 0755 {} + and then below the define {'FSMETHOD',direct line, I added that other line to the wp-content I created a folder called upgrade, and I set everything recursively to www-data, but WordPress said it could not create directory. After adding that other line of PHP, it said, http 500 internal server error. I really want this to work so I won't have to do this manually every time there is a new WordPress update.

<marquee onmouseover="this.stop()" onmouseout="this.start()" direction="up" width="150" height="151" scrollamount="3" align="center">
<ul>

<li><a href="http://bjcatering.com/wedding-organizer-bekasi-fungsi-wedding-organizer/" target="_blank">wedding organizer murah</a></li>
<li><a href="http://bjcatering.com/wedding-organizer-bekasi-fungsi-wedding-organizer/" target="_blank">wedding organizer murah di jakarta</a></li>
<li><a href="http://bjcatering.com/wedding-organizer-bekasi-fungsi-wedding-organizer/" target="_blank">wedding organizer murah di bekasi</a></li>
<li><a href="http://bjcatering.com/wedding-organizer-bekasi-fungsi-wedding-organizer/" target="_blank">wedding organizer murah di depok</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">catering pernikahan murah</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">catering pernikahan murah di jakarta</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">catering pernikahan murah di depok</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">catering pernikahan murah di bekasi</a></li>
<li><a href="http://bjcatering.com/wedding-organizer-bekasi-fungsi-wedding-organizer/" target="_blank">wedding planner bekasi</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">Paket Pernikahan Promo</a></li>
<li><a href="http://bjcatering.com/wedding-planner-jakarta-bj-catering/" target="_blank">wedding planner jakarta timur</a></li>
<li><a href="http://bjcatering.com/wedding-planner-jakarta-bj-catering/" target="_blank">wedding planner bekasi</a></li>
<li><a href="http://http://bjcatering.com/wedding-planner-jakarta-bj-catering/" target="_blank">wedding planner depok</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">paket wedding murah</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">paket wedding murah di bekasi</a></li>
<li><a href="http://bjcatering.com/paket-ekonomis/" target="_blank">paket wedding murah di jakarta timur</a></li>
<li><a href="http://bjcatering.com/catering-pernikahan-bekasi-hemat/" target="_blank">paket pernikahan jakarta timur</a></li>
<li><a href="http://bjcatering.com/paket-pernikahan-dan-paket-catering-depok/" target="_blank">Paket Pernikahan depok</a></li>
<li><a href="http://bjcatering.com/paket-pernikahan/" target="_blank">paket catering pernikahan</a></li>
<li><a href="http://bjcatering.com/paket-khitanan/" target="_blank">Paket catering khitanan</a></li>
<li><a href="http://bjcatering.com/paket-khitanan/" target="_blank">Paket catering khitanan di bekasi</a></li>
<li><a href="http://bjcatering.com/paket-khitanan/" target="_blank">Paket catering khitanan di jakarta timur</a></li>
<li><a href="http://bjcatering.com/paket-khitanan/" target="_blank">Paket catering khitanan di depok</a></li>
<li><a href="http://bjcatering.com/nasi-box/" target="_blank">nasi kotak bekasi</a></li>
<li><a href="http://bjcatering.com/nasi-box-enak-murah-halal-dan-komplit/" target="_blank">nasi box bekasi</a></li>
<li><a href="http://bjcatering.com/nasi-box/" target="_blank">nasi kotak jakarta</a></li>
<li><a href="http://bjcatering.com/nasi-box-enak-murah-halal-dan-komplit/" target="_blank">nasi box jakarta</a></li>
<li><a href="http://bjcatering.com/nasi-box/" target="_blank">nasi kotak depok </a></li>
<li><a href="http://bjcatering.com/nasi-box-enak-murah-halal-dan-komplit/" target="_blank">nasi box depok</a></li>
<li><a href="http://bjcatering.com/nasi-box-enak-murah-halal-dan-komplit/" target="_blank">nasi kotak bekasi</a></li>
<li><a href="http://bjcatering.com/nasi-box/" target="_blank">nasi kotak jakarta</a></li>
<li><a href="http://bjcatering.com/nasi-box-enak-murah-halal-dan-komplit/" target="_blank">nasi kotak jakarta</a></li>
<li><a href="http://bjcatering.com/nasi-box/" target="_blank">nasi kotak depok </a></li>
<li><a href="http://bjcatering.com/nasi-box-enak-murah-halal-dan-komplit/" target="_blank">nasi kotak depok</a></li>

<li><a href="http://wikawaterheater.com/" target="_blank">water heater</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">harga water heater</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">pemanas air</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">water heater listrik</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">ariston water heater</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">pemanas air mandi</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">water heater ariston</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">pemanas air listrik</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">harga pemanas air</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">harga water heater ariston</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">pemanas air gas</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">alat pemanas air</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">harga pemanas air mandik</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">pemanas air tenaga surya</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">water heater modena</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">wika water heater</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">jual water heater</a></li>
<li><a href="http://wikawaterheater.com/" target="_blank">pemanas air ariston</a></li>

<li><a href="https://franchisepadang.com/" target="_blank">rumah makan padang</a></li>
<li><a href="https://franchisepadang.com/" target="_blank">restoran padang</a></li>
<li><a href="https://franchisepadang.com/" target="_blank">restoran sederhana</a></li>
<li><a href="https://franchisepadang.com/" target="_blank">rumah makan pagi sore</a></li>
<li><a href="https://franchisepadang.com/" target="_blank">rm padang sederhana</a></li>
<li><a href="https://franchisepadang.com/" target="_blank">restoran padang sederhana</a></li>
<li><a href="https://franchisepadang.com/" target="_blank">rm padang</a></li>

<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">peluang usaha makanan</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">usaha kuliner yang menjanjikan</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">peluang usaha kuliner</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">bisnis kuliner yang menjanjikan</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">usaha rumah makan</a></li>

<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">usaha warung makan</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">warung makan sederhana</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">bisnis rumah makan</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">konsep rumah makan sederhana</a></li>
<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">bisnis restoran padang</a></li>

<li><a href="https://franchisepadang.com/peluang-franchise/" target="_blank">franchise restoran padang</a></li>

</ul></marquee>

Have another answer? Share your knowledge.