Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently asked a question on StackOverflow and I'm going to re-ask it here as a different question and with some changes and additional information.

I have a bunch of php scripts that need the ability to create, move, and delete files and folders. The scripts also need to move and delete files that have been uploaded via FTP from a Windows machine.

My VPS currently uses DSO, so in order for my scrips to execute and not die with permission errors I've been having to CHMOD all directories and files to 777.

From what I've read, using 777 permissions is insecure and should not be done. I have a VPS, but there are multiple users as I host a number of websites, some of which other people are in control of.

I it may be relevant for me to mention that I ran phpinfo() and found the following under the section "PHP Credits":

User/Group      nobody(99)/99 

I've been doing reading on the subject of file manipulation via php and suPHP vs. DSO, but I'm still unsure of what I should be doing. From what I've read, it seems like switching to suPHP would fix all my problems (no more problems with permissions), but I've read that it dramatically slows down the server.

Could anyone give me any advice on this matter?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

From what I've read, it seems like switching to suPHP would fix all my problems (no more problems with permissions)

Yes, suPHP will solve all permissions related problems provided you do not have anything CHMOD 0777 - suPHP will reject this as a giant security hole and fill your error_log with messages telling you to change it to 0755 at most.

The best way to think of it is this:

  • No suPHP = PHP runs as a "general" user, rather like if you had a domestic helper. You ask the domestic helper to fetch you things then they will, but if you ask them to do things that specifically require you (sign a contract -> write to a file) then they won't be able to.
  • suPHP allows you to have as many domestic helpers as you like, but they all pretend to be you. They can do everything you can do, no more, no less. No problems!

I've read that it dramatically slows down the server.

Where? I have never known this to be a problem, at all.

In summary: switch to suPHP.

share|improve this answer
2  
suPHP is indeed slower than mod_php. However I prefer to use it because it's easier to manage permissions (specially for servers hosting scripts from different departments/users). It also uses less memory. Anyway, I think people looking to use suPHP may as well explore the PHP-FPM (FastCGI Process Manager) included in PHP since 5.3.3 (an marked stable since 5.4.0) which offer similar access separation but with better performance. –  MV. Nov 15 '12 at 22:42

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.