Post image for Upload Permissions for WordPress in Plesk

Upload Permissions for WordPress in Plesk

by Ed Gately on December 10, 2009 · 16 comments

in How To Fix Wordpress,Setting Up Wordpress,Wordpress Advanced

Most of you know that installing WordPress is a pretty easy and straight forward job, and if you don’t know it already just try it out once or twice and you’ll see how easy it is.  But if you’ve been around the block you’ll also know that different hosting environments and situations can throw some different scenarios at you.

Not too long ago I came across a problem that I haven’t seen before.  The situation was installing WordPress in a hosting environment with a Plesk Control Panel.  Although this situation could arise in multiple other environments, I just hadn’t encountered it because I normally prefer to stick to VPS and VDS hosting without a control panel, and I really stay away from purely shared hosting like it’s the plague.

After installing WordPress any time I tried to upload media (with the setting to organize by date) into the WordPress system I would get the error:

Unable to create directory /var/www/vhosts/[mydomain]/httpdocs/wp-content/uploads/2009/11. Is its parent directory writable by the server?

The part that threw me off was that I had created the uploads directory, I gave the directory 777 permissions so that Apache could create files and folders beneath it, and I actually found that the installation would create the “2009″ directory, but nothing any further.  If I went ahead and created the “11″ directory and gave it write permissions then it could write uploads, but once the next month came around same problem again.

To top it all off, I first came across this problem in front of a client that I was teaching some hosting tricks.  So now I was just looking like an idiot.

Turns out the problem was related to Safe Mode.  My own bad habits persisted when normally setting up domains so I would turn Safe Mode off in my own VPS hosting, but when teaching the “correct” way I recommended leaving Safe Mode on.  Well if your scripts are owned by your domain user, and then naturally running under the Apache User, then Safe Mode won’t create objects underneath a path that has mixed ownership.

It will allow the first directory to be created “2009″, but then the next won’t be allowed.  So the easy solution is to turn off Safe Mode.

Some people probably won’t think this is the best option.  The same people don’t like to set public folders to 777.  But if you are on VPS hosting with a Plesk CP inside your container and it’s just your container you are good to go.  No one else has access to your system but you in the first place.

Of course if you are on or providing shared hosting for many customers, this might not be ideal.  With Shared Hosting you will be giving access to those folders to other customers in the same shared environment.  It would be more ideal to just change the ownership of all the WordPress files to “Apache:Apache” or whatever user:group that apache is running as.  Then you can leave Safe Mode on, and folder permissions to be writable only need 755.  Keep in mind that this only works if you are the provider, if you are just hosting on a shared system you won’t have the ability to do this.

Related posts:

  1. Moving your WordPress Site? Don’t forget hidden files.
  2. 5 Ways To Use WordPress Besides Blogging
  3. Accessing WordPress functions from external PHP pages
  4. Are you suffering from WordPress Plugin overload?
About The Author: Hi, I'm Ed Gately and I write Wordpress Master to help bloggers get started in building a successful online blog using Wordpress. Prior to writing on this blog I spent over 16 years working in Corporate IT and have been spreading my wings on the web for 3 years. To learn more about this website and me visit About Wordpress Master.

{ 14 comments… read them below or add one }

Matthew Sweet December 19, 2009 at 1:20 am

Hi! I have been having the same issue as well, folders can’t be created with mixed ownership and Plesk doesn’t support suPHP yet I don’t think.

This is really bugging me because I can’t easily install plugins.

777 on the plugins directory doesn’t work either!

Reply

Jason Diehl December 19, 2009 at 11:49 am

Do you have Safe Mode turned off? That should solve your problem if Safe Mode is turned on currently. If you are in shared hosting then you might not be able to turn it off. If you cannot turn Safe Mode off you would only have 3 Options:
1) Move to a VPS host where you have more flexibility and control over your own environment.
2) Manually upload files via FTP instead of using the Wordpress interface.
3) Ask your host to set all files in your web directory to be owned by Apache.
The third option is not preferred, because you won’t be able to edit any files except through the Wordpress interface. You’ll have to request your host to change it back if you want to edit any files via FTP. The first option might be the most preferred if you have the funds and knowledge to cover the potentially additional expense.

Reply

Matthew Sweet December 20, 2009 at 5:29 am

Hi Jason,
I think I will need to move that account to my own VPS, I don’t have any issues with it (has suPHP installed). I didn’t really want to because the host is so fast and located locally, but with caching and a local edge server for files it should be fine.
Thanks for the tips! I really appreciate it!
Matt

Reply

Diu May 22, 2012 at 8:54 am

rel= nofollow /b /strong/ppBuydrugs wtihout prescription vrg /pdiv style=”display: none”VA:F [1.9.3_1094]/divdiv class=”ratingblock “div class=”ratingheader “/divdiv class=”ratingstars “div id=”comment_rater_739″ class=”ratecmm gdsr-oxygen gdsr-size-16″div class=”starsbar gdsr-size-16″div class=”gdouter gdheight”div id=”gdr_vote_c739″ style=”width: 0px;” class=”gdinner gdheight”/divdiv id=”gdr_stars_c739″ class=”gdsr_rating_as”a id=”gdsrX739X5X0XcXcomment_rater_739Xcomment_loader_739X11X16″ title=”5 / 5″ class=”s5″ rel=”nofollow”/aa id=”gdsrX739X4X0XcXcomment_rater_739Xcomment_loader_739X11X16″ title=”4 / 5″ class=”s4″ rel=”nofollow”/aa id=”gdsrX739X3X0XcXcomment_rater_739Xcomment_loader_739X11X16″ title=”3 / 5″ class=”s3″ rel=”nofollow”/aa id=”gdsrX739X2X0XcXcomment_rater_739Xcomment_loader_739X11X16″ title=”2 / 5″ class=”s2″ rel=”nofollow”/aa id=”gdsrX739X1X0XcXcomment_rater_739Xcomment_loader_739X11X16″ title=”1 / 5″ class=”s1″ rel=”nofollow”/a/div/div/div/divdiv id=”comment_loader_739″ style=”display: none; width: 80px ” class=”ratingloadercomment”div class=”loader flower ” style=”height: 16px”div class=”loaderinner”please wait…/div/div/div/divdiv class=”ratingtext “div id=”gdr_text_c739″/strong5/strong (0 votes cast)/div/div/divdiv style=”display: none”VA:F [1.9.3_1094]/divdiv class=”thumblock “div id=”gdsr_thumb_739_c_up” class=”gdt-size-20 gdthumb gdup”a id=”gdsrX739XupXcX26X20XY” class=”gdt-starrating” rel=”nofollow”/a/divdiv id=”gdsr_thumb_739_c_loader_up” style=”display: none; width: 20px ” class=”ratingloader loadup”div class=”loader thumb flower” style=”width: 20px; height: 20px;”/div/divdiv id=”gdsr_thumb_739_c_dw” class=”gdt-size-20 gdthumb gddw”a id=”gdsrX739XdwXcX26X20XY” class=”gdt-starrating” rel=”nofollow”/a/divdiv id=”gdsr_thumb_739_c_loader_dw” style=”display: none; width: 20px ” class=”ratingloader loaddw”div class=”loader thumb flower” style=”width: 20px; height: 20px;”/div/divdiv class=”ratingtext “div id=”gdsr_thumb_text_739_c” class=”gdt-size-20 gdthumbtext”Rating: strong0/strong (from 0 votes)/div/divdiv class=”raterclear”/div/divdiv class=”reply”a rel=’nofollow’ class=’comment-reply-link’ href=’/?p=117 replytocom=739#respond’ onclick=’return addComment.moveForm(“div-comment-739″, “739″, “respond”, “117″)’Reply/a/div

Reply

Lothar May 8, 2010 at 11:43 am

How dangerous is it to set the permissions to “777″?

Reply

Stuart Turner August 2, 2010 at 5:40 am

Hi,

Very useful – cured my upload / install plugins issue once and for all!

Kind regards,

- Stuart

Reply

Leonel May 21, 2012 at 11:15 am

This is such a great resource that you are priodivng and you give it away for free. I enjoy seeing websites that understand the value of priodivng a prime resource for free. I truly loved reading your post. Thanks!

Reply

Manuel Moreno November 2, 2010 at 12:23 pm

Very useful! Thanks a lot.

Reply

Camilo May 23, 2012 at 10:37 pm

walti_riehen sagt:Elektroheizung ist ein f6kologischer und f6konomischer Blf6dsinn.Es wird erst We4rme erzeugt (egal ob Kern- oder Kohle-Kraftwerk) mit den ennphrecsetden Verlusten.Dann wird aus der We4rme Dampf erzeugt. Erneut mit Verlusten.Dann wird aus dem Dampf Strom erzeugt. Wieder mit Verlusten. Dann wird der Strom zum Verbraucher transportiert, mit Verlust. Und jetzt macht man daraus wieder We4rme, mit nochmals Verlust.Also aus We4rme wird We4rme aber mit viel Verlust.Es kommt noch etwa 30% der ursprfcnglichen Energie am Ende an.

Reply

Leonard Challis January 18, 2011 at 6:08 am

I used to do a similar thing, but then realised that when I wanted to make changes I had to chown my files again or repeat steps I’d earlier taken to fix the problem. I also didn’t like the idea of having my files owner/group different to other files on the web server – as it could cause difficulatires when it came to custom backup scripts and replication, etc.

What I ended up doing was adding my Apache user account to the Plesk user’s group and making all files writable by that group too. Simple blog post here: http://blog.leonardchallis.com/servers/getting-file-permissions-right-in-wordpress/

Reply

Paul Milligan February 22, 2011 at 3:00 am

Thank you! I love the way on the internet all known problems have been found and solved by some expert like yourself, it’s just a matter of using the right words in Google. Now I can add some pictures to my website>

Reply

Gilbert December 6, 2011 at 12:07 pm

I had the same problem, to remedy the situation, I changed the “PHP support” (in the Hosting Settings) from “Apache module” to “FastCGI applications”. This is on Plesk 10.1.1 system.

Hope this will help some of you.

Reply

Jonas Rullo January 2, 2012 at 2:24 pm

The solution may be all of the above as well, however, double check the “..” directory permissions in the uploads directory also. cd into the uploads directory and run the command “ls -la”. You should see the first directory as “.” and the next one as “..”. On my 1and1.com Plesk 10 installation, the permission on my “..” directory was not changed to 777 even when explicitly setting permissions recursively on the uploads directory. I had to explicitly set permission on “..” using “chmod 777 ..” after changing directory into the uploads directory. There are spaces between chmod, 777 and the double dots. Uploads inside Wordpress worked after this command was run. It should not matter if your shell in the plesk subscription/domain is sh, bash, or chroot, etc. Files uploaded will have group and owner set to apache. The uploads directory itself is still the account owner as plesk account name created ownership and group name as psacln.

Reply

Faustino July 26, 2014 at 11:06 am

Licensing also allows for parallel detection of DNA
for performing several primer-walking steps directly on the time to explaining
provide the inner workings of a lot of opportunities.
You should get at the hearing will be more harmful.

Hydration characteristics Silica fume reacts relatively fast in the mold in my state and are strongly encouraged researchers to create a network of contractors employed in organizations are typically joined together at the allocated
time.

Reply

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: