View Single Post

  #2 (permalink)  
Old 01-23-2006
Gnutt Halvordsson
 
Posts: n/a
Default Re: setting directory permission for file upload

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

Reply With Quote