re: [PHP] problem of nesting includes...
| From: | Matt Friedman | Date: | Sun, 14 Oct 2001 18:10:59 +0000 |
| Subject: | re: [PHP] problem of nesting includes... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-71036@lists.php.net to get a copy of this message | ||
> Setting the include path is good because you end up including all files
from
> "/" which you should be doing anyway. Then, whenever you include a file,
the
> file's "file relative" placement in the directory structure is irrelevant.
> All files are referenced from "/". (Or C:\ on windows or whatever)
>
> It's the same with using SSI's. You should always use virtual= instead of
> file=
> You'll save yourself a lot of trouble by doing this properly in the first
> place. Not a fan of nested includes anyway.
>
> You should be able to change this config by using ini_set.
> http://www.php.net/manual/en/function.ini-set.php Try to avoid
> .htaccess
for
> the reasons you mentioned plus ini_set should be quicker.
>
> If you can't or won't set your include path, include all files with the
path
> starting from "/" and you won't have problems.
>
> Matt.
>
>
> ----- Original Message -----
> From: "Christian Dechery" <cdechery@easynet.com.br>
> To: "Christian Reiniger" <creinig@mayn.de>; <php-general@lists.php.net>
> Sent: Sunday, October 14, 2001 10:53 AM
> Subject: Re: [PHP] problem of nesting includes...
>
>
> > At 13:20 13/10/2001 +0200, Christian Reiniger wrote:
> > >On Thursday 11 October 2001 04:15, Christian Dechery wrote:
> > > > We ran a serious thread about "nested includes()" and I saw a lot of
> > > > pseudo-solutions...
> > > >
> > > > and I've just implemented one of them which I think is the best...
but
> > > > while I was doing it I realised it is more 'pseudo' than I tought...
> it
> > > > worked finally.... but this is what I've figured:
> > > >
> > > > MAIN INCLUDE PROBLEM:
> > > > - if a file "a" includes "b" and "b" includes
> > > > "c"... "c" won't have
a
> > > > path relative to "b"... so it won't work... (unless of course
> > > > they
are
> > > > all in the same dir)
> > > >
> > > > there's no 100% safe solution to work around nested includes with
> > > > PHP... right? there's no way you can assure in every file, that
> > > > includes another and another (and so on) in different dirs... that
> it's
> > > > allways safe and you won't run into the MAIN INCLUDE PROBLEM....
> > >
> > >Um, why not simply set PHP's include_path properly? I'm including files
> > >wildly 'round the place and never had any problems with it.
> > >
> > > > if I had:
> > > > /vitrine
> > > > /vitrine/adm
> > > > /vitrine/include
> > > > /vitrine/templates
> > >
> > >php_value include_dir =
> > >.:/xyz/vitrine/adm:/xyz/vitrine/include:/xyz/vitrine/templates
> > >
> > >You then only have to take care that includes' names/paths relative to
> > >these include dirs don't overlap in a harmful way.
> >
> > what if I don't have permissions to change any configs in PHP??? It
> doesn't
> > sound like a great solution.... one should be able to include() without
> > having to alter any server settings...
> > in my case, I run the server, so there's no prob... but what if someone
> > installs my script on a webhost that doesn't allow .htaccess, runs PHP
in
> > safe-mode and all that? how would we solve the 'nested include()'
problem?
> > It has to be 100% generic, or it's not a solution...
> >
> >
> >
> > _____________________________
> > . Christian Dechery
> > . . Gaita-L Owner / Web Developer
> > . . http://www.webstyle.com.br
> > . . http://www.tanamesa.com.br
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
> >
>