Page 1 of 1

chmod newbie question

Posted: Wed Jun 18, 2008 2:08 am
by winxp.tar.gz
hello everyone,

sorry for a noob question, but i was wondering if I could chmod a txt file (eg. test.txt) to make it unreadable for everyone trying to get it via http:

http://my.domain.com/somefolder/test.txt

so it would display a 403 forbidden error. but still i'd like to be able to get its contents in a php script.

i tried a few combinations but i ended up with being able to read it via http AND php script, or not being able to read it at all.

any solutions?

winxp.tar.gz

Re: chmod newbie question

Posted: Wed Jun 18, 2008 4:22 am
by Mordred
It looks like you're doing it from the opposite direction, and since usually PHP runs as Apache module, denying Apache you deny PHP as well.
Try the reverse: deny HTTP access with .htaccess (RTF

Code: Select all

M), and leave the file with its regular chmod bits so the PHP can read it.