For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > setting directory permission for file upload









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author setting directory permission for file upload
news

2006-01-17, 6:57 pm

Using the php manual code examples, I have built a webpage to select a
local file and upload it to the server. At home I have a WAMP setup
(win2k) and it works fine. My live server is running linux. I have
re-set the directory permission from 755 to 777 to get it to work. Can
someone explain to me, or point me to a website that can explain why
group and world need write access? Or does just world need this? I was
under the false impression that the php was running as owner, but I
guess it isn't

Thanks,

Joel Goldstick
Gnutt Halvordsson

2006-01-23, 3:55 am

World and group does not actually need write-access.
PHP need read-write-access to the files, and/or read-write-execute on
the directory which uploads are ment to be.

If you find out as which group the PHP-script executes it's scripts
you can change ownership of the directory which php works within.

PHP genrally runs as the user who executes it (this is often apache).
Therefore it's apache who will need write-permissions.

So give apache (on some systems www-data)-group writeaccess on the
directory intended.

chown <user>:www-data php-work-folder
chmod 775 php-work-folder

news skrev:
> Using the php manual code examples, I have built a webpage to select a
> local file and upload it to the server. At home I have a WAMP setup
> (win2k) and it works fine. My live server is running linux. I have
> re-set the directory permission from 755 to 777 to get it to work. Can
> someone explain to me, or point me to a website that can explain why
> group and world need write access? Or does just world need this? I was
> under the false impression that the php was running as owner, but I
> guess it isn't
>
> Thanks,
>
> Joel Goldstick

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com