Re: include path

From: Date: Wed, 29 Nov 2000 18:17:15 +0000
Subject: Re: include path
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-27852@lists.php.net to get a copy of this message
There's a problem with that though - if you have /a/subdir/file.php and it contains: include('../main.php'); That works fine to include main.php. But if main.php contains: include('another_file.php'); Then it can't find "another_file.php" to include. It lives in /a but your script is really looking in /a/subdir so it can't find it. -dan Previously, Daniel Convissor said: > Hi Thomas: > > > How to set my own include path without editing php.ini?? > > The include_path doesn't need to be set in your php.ini. What may be > tripping you up is trying to include files from the wrong directories. Note, > all directory requests are relative to the INITIAL PHP script called. So, > you'll have to call things like this: > > -------------- > <?php > # This file is /htdocs/someone/subdir/home.php > include("../head.inc"); > echo "That's it"; > ?> -- Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/ #!/usr/bin/perl -iake_one_down_pass_it_around:_bottles_of_beer:_on_the_wall:99 for(($t,$a,$b,$i)=split/:/,$^I;$i;print){$_="-$i$a$b,-$i$a,-T$t,-".--$i."$a$b ";s/(-1_.*?e)s/$1/g;y/_-/ \n/}# by Randolph Chung and Joey Hess

« previous php.general (#27852) next »