How to use PHP set_include_path?

I have setup an Apache server on a Windows XP machine. I would like to have the files I create work on both the XAMPP setup on my Windows XP machine and also work on the live website.

I tried to have my index.php use this:

<?php set_include_path(‘/include’); ?>
and
<?php set_include_path(‘/include’.PATH_SEPERATOR.get_include_path()); ?>

All my include files are in the /include folder off the root for the site.

Then I tried to use <?php include “footer.php” ?> but the file is not found.

What am I doing wrong.

Your [COLOR="DarkSlateBlue"]/include[/COLOR] should be the full path like [COLOR="DarkSlateBlue"]c:/path/to/htdocs/include[/COLOR] or relative to the script like [COLOR="DarkSlateBlue"]./include[/COLOR] (note the dot). You’re almost there. (:

imho the easiest option is to not specify an [fphp]include[/fphp] path in your php.ini or php script and just specify the path (full or relative) in the include(). If you don’t specify a path, include will look for the file in the directory of the script that called the include().

In the past, I have used <?php include($_SERVER[‘DOCUMENT_ROOT’].“/include/footer.php”) ?> from anywhere on the site. So even if I were somewhere like root/sub/sub/sub/fiile.php, that command would get to the root/include folder.

So maybe there is something else I need to do. I think DOCUMENT_ROOT takes me to the root of the site, and at home that is the htdocs folder which is one level up from the mysite folder or the daughers_site folder. The ides is that I would have:
htdocs/mysite01
htdocs/mysite02
htdocs/mysite03
etc.

What are my options?

So DOCUMENT_ROOT does not work from the sub folder. The only folder that I use like that is the include folder.

what I always do is not specify an include_path anywhere and then simply specify the relative path from the current directory on the website to the include file.

the relative path will always start with ./ or …/