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 have a VPS, for some reason php can only exec when permission is 644.

If I changed the php file to 777 or 755, it would throw me an Error 500 internal server error.

I thought 777 give everybody greatest permission, what makes a web server behave like that?

Thank you for your time.

share|improve this question

migrated from stackoverflow.com Nov 2 '10 at 4:27

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers

This is done for the same reason that sshd won't log you in if your .ssh directory is too widely writable.

How does your server know it is really your application if anyone could have changed it?

share|improve this answer
2  
i.e. it's a feature –  Matt Nov 2 '10 at 9:33
    
i.e. Thank you PHP for preventing me from doing something idiotic (no offense). –  Belmin Fernandez Nov 5 '10 at 12:52
add comment

I thought 777 give everybody greatest permission, what makes a web server behave like that?

777 means everybody can read write and execute your www directory. Do you really want people to create "any" files and execute?

Of course not. One of the security 101 principle is principle of least privilege. Basically that means giving a user only those powers which are absolutely essential to do his/her work.

share|improve this answer
add comment

Your webserver might have "suexec" enabled by default. Suexec is very particular about 644 and does not allows file with permissions 755 or 777 to work. You can read about suexec and its pros and cons here http://httpd.apache.org/docs/1.3/suexec.html

share|improve this answer
add comment

Your Answer

 
discard

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