What is set_include_path Relative to, in PHP? Is it the folder where the PHP.exe resides? Is it the webroot? In other words, what folder would set_include_path('/') or set_include_path('.') be referring to?
The filesystem root and the current directory, respectively.
This is relative to your current script, however, absolute paths can be used. If you start the path name with a / on *nix systems it would be a absolute path.
Relative paths are resolved from the location of the file where include or another function that uses include_path is used in (see description of include_path):
Using a
.in the include path allows for relative includes as it means the current directory. However, it is more efficient to explicitly useinclude './file'than having PHP always check the current directory for every include.
/ would describe the root of your filesystem and . the current directory.
set_include_path("/") would make the include path be the root folder of the filesystem, and I would take a guess that you'd probably not want to do that as there might be issues with exposing files that you don't want to be seen.
If your php file was /home/users/joebloggs/htmlroot/index.php, then set_include_path(".") would make the include path the directory that the php file is in, ie the "htmlroot" directory.
On *nix systems and Windows Apache the / is the root of the file system. While on IIS / points to the root of the vhost.
What I do to handle this is define a LOC constant in my index.php so I never get confused when including files.
define('LOC', dirname(__FILE__));
include(LOC . '/files/file.php');