Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Permissions when associated with WordPress is something that I would never understand.

Here are the problems:

First problem is uploading. If I start from a fresh Ubuntu 12.04 installation then moving onto the installation of LAMP stack which I usually do by

sudo apt-get install lamp-server^

then the installation of WordPress. Uploading anything within WordPress will not work. Not themes nor plugins nor data. However, I fixed that by adding files & directories to www-data/apache user & group. Themes, plugins, data can now be uploaded within WordPress. I also added currentuser and root to the usergroup, www-data.

File: www-data:www-data 644

Directory: www-data:www-data 755

Where do I get the idea to do this? It's from a StackOverflow answer which I found a few months ago.

Second, is script execution. In this case, PHP. Despite having the correct perms, 644 (666 sometimes) for files and 755 for directories. However, some WordPress plugins still can't write to them to unless having 777 perms. What's funny is when I look at the support forums of the stubborn plugin, I see no one else reporting this issue.

Help? This is something I have been struggling to solve for months. I can either go

  • a) Find the perms-hungry file and give it 777
  • b) Stop using the plugin

It's usually b) btw.

The plugins that I'm having problems with are: 1) Ep HashImage 2) Easy-Instagram

Basically what they do is download images from an external source and downloads it to wp-content/ not sure specifically where though.

I have tried searching for solutions such as using suexec & suPHP. However, that always ends with my server not working entirely. Is there any other solutions?

Do help me on this, thanks!

share|improve this question
1  
When it comes to OS permissions WordPress is no different than any other folder/file/script. Check your group and user permissions and PHP runtime option (cgi for example) thoroughly, there is no reason a plugin should need 777. –  Wyck Jan 29 at 13:44
    
Trust me, I even re-run sudo find /var/www -type f -exec chmod 644 {} \; sudo find /var/www -type d -exec chmod 755 {} \; sudo chown www-data:www-data /var/www -R –  Adam Jan 29 at 13:48
add comment

1 Answer

I believe the "lamp-server" package in Ubuntu fails to install mod-suphp, which would likely solve most of your permission problems.

Try installing the libapache2-mod-suphp package. And undo everything you did with the permissions. The WordPress install should not be owned by the apache user, it should be owned by the real user.

share|improve this answer
    
Great answer. Funny that I just did that by following the tutorial on this page: help.ubuntu.com/community/ApacheMySQLPHP unless the tutorial is wrong then I did have mod installed & enabled. I got a 500 internal server. And yes, I did restart apache by sudo service apache2 restart You're right at one part though, the package lamp-server does not include suPHP –  Adam Jan 29 at 14:11
    
I'm not an Ubuntu expert, so I can't help you with the details of that. I do know that suPHP prevents files with 777 and similar from running at all, so you might check that. –  Otto Jan 29 at 14:27
    
Not a problem. Thanks for the help by the way. I asked a question on Server Fault as well. Hopefully someone there can help me. I have faced a lot of problems with Unix based OSes and Apache before but this is the one I am still stuck with. –  Adam Jan 29 at 14:31
    
Check your log files for the cause of the 500 error. 85% of my 500 errors have been caused by flawed .htaccess files, but that's just my experience. –  Pat J Jan 29 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.