right now I am using include "../../footer.php" etc for my web site. Clumsy but it works.
I tried FQDN and that does not work.
because I use subdirectories I cannot use /footer.php as PHP is not configured to realize the relative addressing
any suggestions?
FQDN for includes
Moderator: General Moderators
FQDN for includes
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
Re: FQDN for includes
Code: Select all
include $_SERVER["DOCUMENT_ROOT"] . "/footer.php";Code: Select all
include __DIR__ . "/../../footer.php"; // PHP 5.3+Code: Select all
include dirname(__FILE__) . "/../../footer.php";Re: FQDN for includes
Will I need to declare the DOCUMENT_ROOT or will PHP already be aware of it?
include $_SERVER["DOCUMENT_ROOT"] . "/footer.php";
include $_SERVER["DOCUMENT_ROOT"] . "/footer.php";
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
Re: FQDN for includes
DOCUMENT_ROOT is always available if you're running PHP as a server module (in Apache or IIS or whatever). I'm quite sure it's always available if you're using it as CGI too (eg, FastCGI). It is not available if the script runs from a shell or cron job.
Re: FQDN for includes
thanks
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP