Koozali.org: home of the SME Server

WWW user and php script !

WXP

WWW user and php script !
« on: August 08, 2001, 12:46:47 PM »
Hello.

I just made a PHP Script i'm using to download files and my trouble is that the user WWW cannot write in the folder the script is !!
Would it be dangerous to run the command as root ? And how to do it ?
Or how is it possible to modify the directory properties so WWW can write into it ?

Thanx

Allen Rapini

Re: WWW user and php script !
« Reply #1 on: August 08, 2001, 04:12:54 PM »
as root:
chown -R www "directory"
chgrp -R www "directory"

this will recursively change that "directory" and it contents to be owned by www

WXP

Re: WWW user and php script !
« Reply #2 on: August 08, 2001, 04:28:45 PM »
Hi !

Thank you for answering so fast !

I only have a problem with your answer which is maybe not a problem ;-)

My directory (where the php file is) is owned by root.
Isnt it a security hole if i chowned it to www ?

Or there is no problem doing this ?

Thanx

CMG

Re: WWW user and php script !
« Reply #3 on: August 08, 2001, 08:33:58 PM »
you could do a symbolic link

ln -s /usr/local/real-location /home/e-smith/files/ibays/www-location


That should do it... and follow Allen's advice regarding chown/chgrp.  That way your "REAL" files stay put, however you can do symlink to any directory you want.

Stay away from Root at all costs... unless you can't do it any other way.

WXP

Re: WWW user and php script !
« Reply #4 on: August 08, 2001, 09:36:26 PM »
Hey thanx for the answer !

In fact, I tried to chown and chgrp the rep /home/e-smith/.../downloader to www
but it's still not working... @!#$ ..

Just for infomation, I have to launch wget from a php script to download a file.
My thought is that wget cannot write into /home/e-smith/.../downloader


Help would be appreciated ;-) Thanx

WXP

Re: WWW user and php script !
« Reply #5 on: August 08, 2001, 10:09:24 PM »
Guys !! I'm a dumbass !!

Damn it I put the before the TEXT which contains the URL so my Download PHP Page never received any url !!

AAARRFFFF I'm stupid some times ;-)

Cya and thanks for help !