include problem

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

    #1

    include problem

    I'm running Debian Linux stable and PHP 4.1.2. My include_path is

    '.:/php/includes:/usr/local/lib/php/:/usr/local/lib/php/smarty/'

    Problem is,

    include('/includes/foo.php');

    doesn't work, returning a Failed opening error. If I put in the full
    path, it works just fine. Do site-based absolute paths not work in
    general, or is it a version problem, or what?
    --
    msnomer
    =======
    Cool free games and much more here:
    http://www.neopets.com/refer.phtml?username=msnomer
  • Jan Pieter Kunst

    #2
    Re: include problem

    In article
    <msnomer-160676.15384905 042004@dsl254-095-101.nyc1.dsl.sp eakeasy.net>,
    meredith <msnomer@spamco p.net> wrote:
    [color=blue]
    > include('/includes/foo.php');
    >
    > doesn't work, returning a Failed opening error. If I put in the full
    > path, it works just fine. Do site-based absolute paths not work in
    > general, or is it a version problem, or what?[/color]

    The root of an absolute path in a PHP script is the 'real' filesystem
    root, not the web server's 'document root'.

    JP

    --
    Sorry, <devnull@cauce. org> is een "spam trap".
    E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

    Comment

    • meredith

      #3
      Re: include problem

      In article <devnull-EC2171.21431705 042004@news1.ne ws.xs4all.nl>,
      Jan Pieter Kunst <devnull@cauce. org> wrote:
      [color=blue]
      > In article
      > <msnomer-160676.15384905 042004@dsl254-095-101.nyc1.dsl.sp eakeasy.net>,
      > meredith <msnomer@spamco p.net> wrote:
      >[color=green]
      > > include('/includes/foo.php');
      > >
      > > doesn't work, returning a Failed opening error. If I put in the full
      > > path, it works just fine. Do site-based absolute paths not work in
      > > general, or is it a version problem, or what?[/color]
      >
      > The root of an absolute path in a PHP script is the 'real' filesystem
      > root, not the web server's 'document root'.
      >
      > JP[/color]

      Well, how annoying! So the only way to put in an absolute path (which is
      necessary for subdirectories) is the append the "real" root? Bletch!
      --
      msnomer
      =======
      Cool free games and much more here:
      http://www.neopets.com/refer.phtml?username=msnomer

      Comment

      • Pedro Graca

        #4
        Re: include problem

        meredith wrote:[color=blue]
        > Well, how annoying! So the only way to put in an absolute path (which is
        > necessary for subdirectories) is the append the "real" root? Bletch![/color]

        You can do:
        include $_SERVER['DOCUMENT_ROOT'] . '/include/foo.php';
        --
        USENET would be a better place if everybody read: : mail address :
        http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
        http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
        http://www.expita.com/nomime.html : to 10K bytes :

        Comment

        • Yannick Turgeon

          #5
          Re: include problem

          Just to make sure there is no misunderstandin g. You can specify a file from
          a subdirectory relatively (and not absolute). In your situation, if the
          directory "includes" is a sibling of your main file you can include foo.php
          like that:
          include('includ es/foo.php') (Without the leading slash)

          HTH

          Yannick

          "meredith" <msnomer@spamco p.net> wrote in message
          news:msnomer-1569B1.15585705 042004@dsl254-095-101.nyc1.dsl.sp eakeasy.net...[color=blue]
          > In article <devnull-EC2171.21431705 042004@news1.ne ws.xs4all.nl>,
          > Jan Pieter Kunst <devnull@cauce. org> wrote:
          >[color=green]
          > > In article
          > > <msnomer-160676.15384905 042004@dsl254-095-101.nyc1.dsl.sp eakeasy.net>,
          > > meredith <msnomer@spamco p.net> wrote:
          > >[color=darkred]
          > > > include('/includes/foo.php');
          > > >
          > > > doesn't work, returning a Failed opening error. If I put in the full
          > > > path, it works just fine. Do site-based absolute paths not work in
          > > > general, or is it a version problem, or what?[/color]
          > >
          > > The root of an absolute path in a PHP script is the 'real' filesystem
          > > root, not the web server's 'document root'.
          > >
          > > JP[/color]
          >
          > Well, how annoying! So the only way to put in an absolute path (which is
          > necessary for subdirectories) is the append the "real" root? Bletch!
          > --
          > msnomer
          > =======
          > Cool free games and much more here:
          > http://www.neopets.com/refer.phtml?username=msnomer[/color]


          Comment

          • RT

            #6
            Re: include problem

            I had the same problem yesterday and found that if I did the following it
            worked - include('../../includes/foo.php') for some reason putting 2 ..
            Then the slash / makes it function properly.

            RT

            On 4/5/04 4:06 PM, in article Y_icc.13644$wq4 .665840@news20. bellglobal.com,
            "Yannick Turgeon" <nobody@nowhere .com> wrote:
            [color=blue]
            > Just to make sure there is no misunderstandin g. You can specify a file from
            > a subdirectory relatively (and not absolute). In your situation, if the
            > directory "includes" is a sibling of your main file you can include foo.php
            > like that:
            > include('includ es/foo.php') (Without the leading slash)
            >
            > HTH
            >
            > Yannick
            >
            > "meredith" <msnomer@spamco p.net> wrote in message
            > news:msnomer-1569B1.15585705 042004@dsl254-095-101.nyc1.dsl.sp eakeasy.net...[color=green]
            >> In article <devnull-EC2171.21431705 042004@news1.ne ws.xs4all.nl>,
            >> Jan Pieter Kunst <devnull@cauce. org> wrote:
            >>[color=darkred]
            >>> In article
            >>> <msnomer-160676.15384905 042004@dsl254-095-101.nyc1.dsl.sp eakeasy.net>,
            >>> meredith <msnomer@spamco p.net> wrote:
            >>>
            >>>> include('/includes/foo.php');
            >>>>
            >>>> doesn't work, returning a Failed opening error. If I put in the full
            >>>> path, it works just fine. Do site-based absolute paths not work in
            >>>> general, or is it a version problem, or what?
            >>>
            >>> The root of an absolute path in a PHP script is the 'real' filesystem
            >>> root, not the web server's 'document root'.
            >>>
            >>> JP[/color]
            >>
            >> Well, how annoying! So the only way to put in an absolute path (which is
            >> necessary for subdirectories) is the append the "real" root? Bletch!
            >> --
            >> msnomer
            >> =======
            >> Cool free games and much more here:
            >> http://www.neopets.com/refer.phtml?username=msnomer[/color]
            >
            >[/color]

            Comment

            Working...