[vox-tech] php and including with absolute paths
Richard S. Crawford
rscrawford at mossroot.com
Tue Jan 17 11:12:05 PST 2006
Peter Jay Salzman wrote:
> Is it possible to ask PHP to include/require files with an absolute
> pathname
> rather than pathname relative to PHP's search path? I'd like to do
> something along the lines of:
>
> require_once('/www/foo/bar.php');
Do you mean from the server's root? Should be, though it might depend on
your server's setup. I do it all the time, particularly with config.php
files that need to be included in every file throughout a site's directory
structure. For example:
require_once('/usr/www/users/jenipurr/mossroot/config.php');
You might also be able to use $_SERVER['DOCUMENT_ROOT'] for increased
portability, but I haven't actually done this myself (due mostly to
extreme laziness on my part).
--
Richard S. Crawford
http://www.mossroot.com
"That which does not kill me makes me stranger."
--Llewellyn
More information about the vox-tech
mailing list