permission's mystery

Joined
Nov 27, 2011
Messages
5
Reaction score
0
Points
1
Hello.
My MAC OS is Leopard and I use the computer personally, i.e. I'm admin user.
I've just started PHP, so I created a local server and changed the computer's permission to make it work.

My question is why 755 doesn't work for a simple PHP program, but 777 works.
Permissions for the folder and files are like this
:the folder in Sites/ ---777, php files in the folder ---755

I think '7'55 should be enough because I am the admin, neither a guest nor a member of some group. However, 755 for the folder doesn't work.
Would anybody help me to solve the mystery?
Thanks.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
I highly doubt that your server instance (assuming it's a daemon) is running as your user.

You certainly should NOT run this as 777, 755 is indeed preferable. You'd need to change the owner to the user running your server instance using chown. That'd do it.
 
OP
T
Joined
Nov 27, 2011
Messages
5
Reaction score
0
Points
1
I still don't understand the difference between administrator and root user...
Any way, I 'll try chown, thank you Dysfunction!
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Here's the deal. Say you're running apache. Generally this is run by a non-privileged user (such as "www"). So, if you chown www <file> it should be able to execute your PHP script. This has nothing to do with the user you're logged on as. In fact, running servers as your (privileged) login would be a VERY bad idea indeed. There are a TON of exploits that exist in various daemons.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
There's also a difference between administrator and root in OS X. Take a look here. They're close but root is one step closer to absolute/unrestrained control.

Dysfunction is very much correct on this one - 777 is a terrible set of permissions for what you're trying to do. It's a "quick fix" for most problems but it's a terrible one. I understand why you'd want to do it though - PHP scripts can be frustrating if they don't have the perfect set of permissions (I can't tell you the number of times this has frustrated me).

I've noticed that this problem generally pops up when you move scripts across machines. Are you doing development across machines?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top