Path to include file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas Mlynarczyk

    Path to include file

    Hello,

    I want to include an inc file into a number of files residing in different
    directories and different directory levels. Apart from setting include_path
    accordingly, isn't there a simple syntax to give a path relative to the
    document root? "/mypath/myfile.inc" doesn't seem to work...

    Thanks in advance,
    Thomas



  • Jeroen Smaal

    #2
    Re: Path to include file


    "Thomas Mlynarczyk" <blue_elephant5 5@hotmail.com> wrote in message
    news:cc3v4e$i74 $07$1@news.t-online.com...[color=blue]
    > Hello,
    >
    > I want to include an inc file into a number of files residing in different
    > directories and different directory levels. Apart from setting[/color]
    include_path[color=blue]
    > accordingly, isn't there a simple syntax to give a path relative to the
    > document root? "/mypath/myfile.inc" doesn't seem to work...
    >
    > Thanks in advance,
    > Thomas
    >
    >
    >[/color]


    include $_SERVER['DOCUMENT_ROOT'].'/mypath/myfile.inc';

    Jeroen.


    Comment

    • Thomas Mlynarczyk

      #3
      Re: Path to include file

      Also sprach Jeroen Smaal:
      [color=blue]
      > include $_SERVER['DOCUMENT_ROOT'].'/mypath/myfile.inc';[/color]

      Seems to be my only choice then (provider won't let me mess up php.ini).
      Still, why doesn't PHP accept "/mypath/myfile.inc" for a path relative to
      the doc root? For web documents, this syntax works fine with Apache.



      Comment

      • Matthias Esken

        #4
        Re: Path to include file

        Thomas Mlynarczyk schrieb:
        [color=blue]
        > Still, why doesn't PHP accept "/mypath/myfile.inc" for a path relative to
        > the doc root? For web documents, this syntax works fine with Apache.[/color]

        PHP is more than an Apache extension.

        Regards,
        Matthias

        Comment

        Working...