>what is the path of the "includes" directory
>in a windows dist of PHP (current version)?
>is that where all the dlls are?


The DLLs are in your "extensions_path" (or something like that).

Your include_path is where *YOUR* PHP files can be placed so you can use
them in multiple scripts.

The simplest example:

Imagine you have a masthead and navigation bar that is the *SAME* on every
damn page on your site.

Now, you could type it a zillion times, or you could rely on your fancy HTML
editor to archive it and re-use it in every page for you, but it's *really*
easy to create a 'navbar.inc' file, and then in every page do:

<?php include 'navbar.inc''?>

If you need to change your navigation bar, you just change navbar.inc

Now, when PHP goes *LOOKING* for 'navbar.inc', because you did <?php include

The include_path is *where* PHP will look.

The first thing I do on any new site is to change my include_path to
something like this:

include_path = "./:/www/example.com/includes/"

This assumes your ISP uses /www/example.com/ as your "home" directory -- the
one with 'htdocs' (or 'www' or 'web' or wherever you upload your HTML)

You can then throw all your include files in the 'includes' directory.

This is because you do *NOT* want malicious users surfing *directly* to:


There are just too many ways that could be abused to do nasty things and
break into your site, once you start putting database passwords and other
cool stuff in your include files.

Meanwhile, back to the include_path "./:/www/example.com/includes/"

The "./" part says to look in the current directory first.
The ":" part separates one directory from the next.  (Use ; in Windows.)

You can list as many directories as you want.

*Occasionally*, in a complex site, I'll have a different include file with
the same name in the same directory as my HTML, and it will "over-ride" the
other include file in the includes directory.  That's why I like to have
"./" first.  A truly paranoid site with multiple developers should probably
*NOT* do that, since it would be too easy for a file to end up in the wrong

But you can make the include_path list whatever makes sense to you.

I also use include for:
1.  CSS, when I'm forced to use it
2.  META tags of description/content
3.  'globals' functions that I use in every page -- most notably a font()
function that avoids the tedium of typing long FONT tags, without using the
badly-broken CSS (see 1.)
4.  Any large block of display that needs to be the same in two pages due to
goofy design by the client.
5.  Database connections, to get them out of the public directory, and, more
importantly, for when I have to move to a different web-server or change the
password or whatever there's only one (1) place it's written down.

Like Music?  http://l-i-e.com/artists.htm

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to