How does PHP read/write/execute?

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Joined: Aug 04, 2008
  • Posts: 846
  • Status: Offline

Post April 16th, 2012, 9:56 pm

Does PHP use the permissions set on the user who is currently logged in to the server and run under those permission? Or does it create a temporary user on the system? Or does it use the "Everyone" group? I mean if I set a file that I nor anyone else has permission to read/write/or execute, will PHP be locked out from that file? Who's permissions would have to be set on a file for PHP to read/write to the file?
Use your words like arrows to shoot toward your goal.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 16th, 2012, 9:56 pm

  • Zealous
  • Guru
  • Guru
  • User avatar
  • Joined: Apr 15, 2011
  • Posts: 1194
  • Loc: Sydney
  • Status: Offline

Post April 17th, 2012, 4:54 am

you chmod it, depends on the function. but yea 777 is usually fine.
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Joined: Aug 04, 2008
  • Posts: 846
  • Status: Offline

Post April 17th, 2012, 1:33 pm

Yeah, I was more curious as to which user/group the PHP processes fall under. 777 gives read/read/execute to everyone, but I'd like to know which specific group/user PHP uses when executing a script that effects a file.
Use your words like arrows to shoot toward your goal.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Joined: Apr 15, 2011
  • Posts: 1194
  • Loc: Sydney
  • Status: Offline

Post April 17th, 2012, 11:09 pm

chmod [options] mode[,mode] file1 [file2 ...]

7 full
6 read and write
5 read and execute
4 read only
3 write and execute
2 write only
1 execute only
0 none

Then there is Global rights/user rights and admin rights one digit each. (Just making a note for others)

r read read a file or list a directory's contents
w write write to a file or directory
x execute execute a file or recurse a directory tree
X special execute
s setuid/gid
t sticky

So php would need a few of these functions to be able to work. you would need at least +rx to run i think.

655 is usually safe, but then again i have never really had permission issues with php unless installing pre made software like SMF. i think i am going to do some research about it

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 217 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.