NYCPHP Meetup

NYPHP.org

[nycphp-talk] IIS 5 and .inc files

Keith J Richardson Keith.Richardson at thompsonhealth.com
Tue Jan 13 13:23:06 EST 2004


I think I figured it out, if I can understand what you want done..

1) Need PHP to include a file from a directory. in my example, it is http://localhost/testing/index.php
2) The include directory needs to have scripts able to read it, but must deny browsing to those pages. - http://localhost/testing/include/lib.inc

What I did:

1) Go into IIS management, and select the directory that you want to change the persmissions on, and in my example, it is /testing/include/
2) Right click on the folder, and select properties.
3) Uncheck read access. There should be nothing in the checkboxes.
4) Test!

You disabled read access from IIS to access those files, so when you type in http://localhost/testing/include/lib.inc - it will give you a HTTP 403.2 - Forbidden: Read Access Forbidden error. The reason why PHP can read the files, is that the system has NTFS permissions to read the file. When php opens a file to read, unless it opens it via a http:// command, it will read it locally, which IIS has no control over.

Hope that helps!

Keith Richardson

-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Emmanuel Décarie
Sent: Tuesday, January 13, 2004 12:46 PM
To: talk at lists.nyphp.org
Subject: [nycphp-talk] IIS 5 and .inc files


Hello,

My client has a Win2000 server with IIS 5 installed. The sysadmin is saying to
me that for IIS *not* to serve dot inc files (like lib.inc), you can't simply
use the suffix of the file (as with Apache) and exclude all dot inc files based
on their suffix. What you have to do is to put all your dot inc files in a
repertory, and then tell IIS that the repertory contains files that are
executable but not to be seen in the browser.

I'm not a Windows guy (although I have IIS 5/Win2000 on a test machine), but I
find it hard that IIS 5 can't discriminate files to be seen by the browser based
on their suffix. Is it true?

TIA

Cheers
-Emmanuel
--
Emmanuel Décarie / Programmation pour le Web - Programming for the Web
<http://scriptdigital.com/> - Blog: <http://blog.scriptdigital.com> - AIM: scriptdigital
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk


More information about the talk mailing list