Page 1 of 1

php scripts and file permissions

Posted: Thu Mar 17, 2005 9:51 pm
by nigma
I've got a php script that reads data from a text file. I'd like the text file to not be visible to anyone who types in the url, but the php script needs to have access to it. What would the permissions be on such a file?

Re: php scripts and protected files

Posted: Thu Mar 17, 2005 9:53 pm
by hongco
nigma wrote:I've got a php script that reads data from a text file. I'd like the text file to not be visible to anyone who types in the url, but the php script needs to have access to it. What would the permissions be on such a file?
just save your text files outside your webroot; your php script will have direct access to the text files; hence, to view the files by users, they must execute your php script which yields your desired outputs.

Posted: Thu Mar 17, 2005 10:01 pm
by nigma
All i've got access to over ftp is webroot and child folders.

Posted: Thu Mar 17, 2005 10:24 pm
by feyd
why not make the text file a php file? You can prepend a comment mark for each line of data, and surround the whole thing in <?php ?> .. so even if someone requests the file, they get bubkes

Posted: Thu Mar 17, 2005 10:58 pm
by nigma
excellent idea feyd, thanks a bunch.