• Using the wordpress admin/settings/misc page I checked “organize my uploads into month- and year-based folders”.

    When trying to upload an image I get the following error message:

    Unable to create directory […]/uploads/2008/06″. Is its parent directory writeable by server?

    Changing the permissions of the upload folder to 777 (just for testing!) leads to the same error message, but this time the directory 2008 has been created by “www-data” (or maybe “nobody”, depends on the server).
    Nevertheless, the 06 subdirectory is still missing.

    This is a permission/ownership problem which can be solved – if you have root access – and if you manage to contemplate this mantra:

    When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory. – https://de.php.net/features.safe-mode

    Meaning: if www-data executes your scripts (owned by you, not www-data) wordpress will create a year-directory which is owned by www-data. Afterwards it will create the month-subdirectory, but now the owner of the script (you) does not match the owner of the directory (www-data) it operates on.

    Changing the owner of all WordPress files to www-data should do the trick, but isn′t really an option. Just changing only the group-ids, while turning safe_mode_gid in the php.ini file on should work.
    But actually turning php safe_mode off seems to be the way to go.

    Hope this helps some people who encountered the same problem,
    Armin

Viewing 4 replies - 16 through 19 (of 19 total)
  • Tx, BHopkins, this worked for me :

    Under Settings > Misc > I totally deleted everything in the “Store uploads in this folder” box. Underneath that box it says, “Default is wp-content/uploads”. My box had something totally different.

    Roki84, interesting what you noted :

    Go to General Settings and in WordPress address URL field leave: https://yoursite.com. This one is wrong: https://www.yoursite.com.

    I had to change & keep my URL to https://www.yoursite.com, because I entered it that way into Google Webmaster tools, loaded the sitemap & Google indexed the WWW URL. So changing that could have something to do with this FRUSTRATING problem!!

    THANKYOU BHOPKINS, I lava ya!!!!!!!!!!!!!!!!!!

    I fixed it using the info reply from BHopkins which says:

    Under Settings > Misc > I totally deleted everything in the “Store uploads in this folder” box. Underneath that box it says, “Default is wp-content/uploads”. My box had something totally different.

    When I removed everything from that box and saved it, it immediately worked, no chmod’ing anything.

    I need to reiterate as well – this is your fix:

    Under Settings > Misc > I totally deleted everything in the "Store uploads in this folder" box. Underneath that box it says, "Default is wp-content/uploads". My box had something totally different.
    
    When I removed everything from that box and saved it, it immediately worked, no chmod'ing anything.

    I doubt this solution would work for everyone, but what eventually solved this issue for me was to specify the full path to the image folder, ex.
    https://www.yourwebsite.com/wp-content/images
    or whatever the complete path to your images folder is too. I also have permissions set to 777 for that folder.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘image upload problem – parent directory writeable’ is closed to new replies.