Click to See Complete Forum and Search --> : 777 - any other way?


furanku
08-07-2003, 07:59 PM
Hi,
with PHP (at Apache/1.3.27 (Unix)) i need my dir on 777 to write files. But this means everybody could. Thats what i dont want.
As far as i know its because PHP is unknown by the server - so it needs 777.
-How can i write files without have my dir in 777 mode?
-Or can change the dir to 777, write the file, and change back to 775?
-Or how can i give PHP the permissions of the owner?


Thanks
Ciao Fu-Ran-Ku

ksandom
08-07-2003, 10:00 PM
find out what user the php process is using. I suspect it will be using the "apache" user. Once you have established this, there are a few main ways you can go:
1) chgrp and chown the dir to the username that is using the dir.
2) Add the username to the group that owns the directory (becareful not which permissions you give here, because it will effect all dirs that have that group owner)
3) Create a new group especially for this task. Add all users that you want to access the dir to this group.

Permissions will depend on on which option you chose, but make sure the third digit only allows a small number of rights.

Truti
08-14-2003, 06:14 PM
Change the chmod at jeg moment you php script are working!

http://dk2.php.net/manual/en/function.chmod.php

I will not recomend this solution... it's a bit unsafe, but works!

btw: php is running as user on the *nix system, and is not by a unknown status!

search google.com for a chmod calc.... chmod is a ***** and i can't remember the exact number for you!