php chmod?

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-03-2003
yawnmoth
 
Posts: n/a
Default php chmod?

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);
?>
Reply With Quote
  #2 (permalink)  
Old 10-03-2003
KAH
 
Posts: n/a
Default Re: php chmod?

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
Reply With Quote
  #3 (permalink)  
Old 10-05-2003
Alexander Grümmer
 
Posts: n/a
Default Re: php chmod?

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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:32 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0