deve cot
deve cot

Reputation: 35

Unable to create directory wp-content/uploads/2014/07. Is its parent directory writable by the server?

Hi anyone can help me for this issue , I have developed a site and it is hosted on my development server but now my client wants to move it to his own production server, and my client doesn't have access to his cpanel for this server. I only have the ftp access, so I have added his database in my own development server, while in development I used my amazon s3 for storing the images , when I push to production I loss the amazon plugin . I can't able to install the plugin , so I moved to upload once again to those images through WordPress, now I face this error while uploading an image : Unable to create directory wp-content/uploads/2014/07. Is its parent directory writable by the server? , and change the ftp file permission access to 755 and changed the uploads file permission to 777 , Still I am not able to upload the images, can some one help me for this issue.

Upvotes: 1

Views: 4139

Answers (2)

Anjani Barnwal
Anjani Barnwal

Reputation: 1522

run these command to provide proper file permissions

Add existing 'ubuntu' user to 'www-data' group

sudo usermod -a -G www-data ubuntu;

Set the ownership of the files/directories

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

Set group ownership inheritance

sudo chmod g+s /var/www/html/;

Set the permissions of the files/directories

sudo find /var/www/html/ -type d -exec chmod 755 {} ;

sudo find /var/www/html/ -type f -exec chmod 644 {} ;

Give write permissions to the group (for editing files via FTP)

sudo chmod -R g+w /var/www/html/;

Upvotes: 0

Iago
Iago

Reputation: 1214

This is a problem of the Apache permissions. I had this problem and i broke my mind for many days to understand what was happening.

The correct way (USE IT):

(the solution that i used, and worked)

You need to give Rewrite permissions to the Apache.

For Ubuntu:

  • Run via ssh: chown -R www-data:www-data /var/www/the/wordpress/directory

For Centos:

  • Run via ssh: chown -R apache.apache /var/www/the/wordpress/directory

The Wrong Way (I don't recommend it, but works...)

You can change the permissions to 777 in all the paths that Wordpress need to change. wp-content/plugins recursively on folders to solve install/update problems, and wp-content/uploads recursively on folders to solve upload media problems.

Never use it because you are giving permissions to anyone change your files. A open way for the crackers that don't like you.

Upvotes: 3

Related Questions