|
Posted by Toby Inkster on 01/20/07 10:49
Jerry Stuckle wrote:
> $_SERVER['DOCUMENT_ROOT'] will ALWAYS contain the absolute path to the
> root directory of your site, no matter where it is. You need to make no
> changes to any files when referencing this way.
Makes it tricky to move your PHP around *within* your document root
though. I try to make my code run equally well rooted in "/somedir/" as it
does in "/".
Putting everything in an 'includes' directory and then specifying the
location of the files in include_path allows you to easily move the
includes anywhere (including outside the document root altogether, which
is often desirable from a security POV) without making any changes to your
scripts at all.
> Then you don't need any entry in your .htaccess file (which even Apache
> recommends against using), you don't have to worry about setting it up
> or anything else. Everything works automatically.
Better to use "httpd.conf" or "php.ini" for such settings, but not
everyone is able to. I tend to use ".htaccess" for testing and then
migrate to "httpd.conf" once I'm sure.
> And BTW - it works in IIS also, which doesn't have a .htaccess file.
> Works great, in fact.
As does "include_path" -- you just need to set it in php.ini.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|