This is a discussion on php chmod? within the PHP Language forums, part of the PHP Programming Forums category; say i have a php script that i access via the web and that creates a file whose permissions are ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
say i have a php script that i access via the web and that creates a
file whose permissions are changed to 600 (ie. only the owner can read or write the file). when i try to download the file with the webbrowser... i can. what i want is to not be able to download the file, itself. i only want the php script i wrote to download the file... how could i do this? is it simply a matter of changing the permissions? anyways, here's my code: <? system("ls -l > test.txt"); chmod("test.txt", 0600); ?> |
|
|||
|
yawnmoth <terra1024@yahoo.com> wrote in
news:2sfqnv4k654p4a3g58oab980iqttbi3af1@4ax.com: > say i have a php script that i access via the web and that creates a > file whose permissions are changed to 600 (ie. only the owner can read > or write the file). when i try to download the file with the > webbrowser... i can. what i want is to not be able to download the > file, itself. i only want the php script i wrote to download the > file... how could i do this? is it simply a matter of changing the > permissions? To answer to this is simple: PHP is being run by the same user as the webserver. KAH |
|
|||
|
Hi,
yawnmoth wrote: > say i have a php script that i access via the web and that creates a > file whose permissions are changed to 600 (ie. only the owner can read > or write the file). when i try to download the file with the > webbrowser... i can. what i want is to not be able to download the > file, itself. i only want the php script i wrote to download the > file... how could i do this? is it simply a matter of changing the > permissions? Nop, here we need to do some tricky stuff. You can place the file on a other location like /home/foo (the permissions must be so that php can read an write here. You webserver looks in the /var/www/htdocs (or something like thist) or maybe in /home/foo/public_html. So you can have php read an write the file, but you can not make an URL that point to that file. > > anyways, here's my code: > > <? > system("ls -l > test.txt"); > chmod("test.txt", 0600); > ?> So long Alexander |