Includes

From: Date: Sun, 20 Apr 2003 17:11:39 +0000
Subject: Includes
Groups: php.general 
Request: Send a blank email to php-general+get-144555@lists.php.net to get a copy of this message
Is there any way to "dynamically" alter the include path during a page load? Something like Perl's use lib idea. I'm in a shared hosting environment where I don't have access to the php.ini file. The web root on the chroot host is /var/www/html and is where all of my include files are at. If I: require_once("header.php"); From a page within /var/www/html it works fine. If I (per my ISP's instructions): require_once("/header.php"); It fails (can't find include). If I: require_once("header.php"); require_once("/header.php"); From any page in any directory below /var/www/html it fails (the usual error). Question with the / in the require. Is that going to the server root (/) directory to look for the page or the root of the site the calling page is loading from? Can I somehow "push" /var/www/html onto the include stack during the initial page load somehow (perl's push(@INC) kind of thing? Should I / could I somehow grab the server name from the QUERY_STRING and prepend that to the require then fetch the page over HTTP?

« previous php.general (#144555) next »