Unable to create directory wp-content/uploads/2016/03. Is its parent directory writable by the server?
I have set up a droplet running ubuntu 14.04X64 with Sentora Control Panel. Within the sentora control panel, I have created FTP accounts. I uploaded wordpress via FTP and successfully installed on my droplet.
I attempted to upload a theme from my laptop via the wordpress Add Themes uploader. The theme upload is failing and I am getting the error below:
"Unable to create directory wp-content/uploads/2016/03. Is its parent directory writable by the server?"
I observed the same thing when attempting to install a theme from the wordpress theme repository.
The /wp-content, /wp-content/themes and /wp-content/uploads folder's permission is originally 755, I changed this to 777 and the theme upload succeeded each time.
What is a more practical way of resolving this issue as file permission 777 is a big security risk and not future proof?
Its all about permissions:
You need to add a group, e.g., www or www-data [ These are the common groups in web hosting, but you can choose what ever you want ]
root@cubox208:/# useradd apache
root@cubox208:/# usermod -a -G www apache
root@cubox208:/# chown -R root:www /var/www
root@cubox208:/# chmod 2775 /var/www
root@cubox208:/# find /var/www -type d -exec chmod 2775 {} +
root@cubox208:/# find /var/www -type f -exec chmod 0664 {} +
reload your apache & mysql
NOTE: We need to make sure the files in /var/www/ have 664 permissions and all directories have 755 permissions. Use sudo if you are not root. Also you can bypass the ftp user credentials while uploading the themes by adding this line at the end of the wp-config file.