Re: Security in included PHP files

From: Date: Wed, 15 Jan 2003 20:50:16 +0000
Subject: Re: Security in included PHP files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131750@lists.php.net to get a copy of this message
--- Jacob Copsey <jacob@skyhill.com> wrote: > My style of PHP is to name all included files with a .php > extension and of course this raises the problem of people > accessing these script files directly. I always name included files *.inc myself, but that's a personal preference combined with a strong desire to adhere to strict naming conventions. It is very easy to make sure people cannot access your include files directly. There are two common ways to do this, and I will mention my preference first. 1. Do not store your include files under document root. This is a very simple and straightforward approach that negates all of the types of questions you were asking. 2. Deny access to any file with an extension of inc. Of course, you would have to conform to a naming standard a bit more for this to work. A quick Google search revealed this example for Apache: <Files ~ "\.inc$"> Order Allow, Deny Deny from all </Files> Chris

« previous php.general (#131750) next »