Problem with include

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

    Problem with include

    Hi,

    When I try to use include with relative path, I've got the error:


    Fatal error: main(): Failed opening required '..\includes\db .php'
    (include_path=' .:/home/lib') in
    /home/users/peter/public_html/events/users/logon.php on line 13

    But during testing the same code on localhost I had no problems. Where
    is the problem and how to solve it? Do I have to define include_path?

    Thanks

    Peter
  • Patrick Trettenbrein

    #2
    Re: Problem with include

    Bromus wrote:
    [color=blue]
    > Hi,
    >
    > When I try to use include with relative path, I've got the error:
    >
    >
    > Fatal error: main(): Failed opening required '..\includes\db .php'
    > (include_path=' .:/home/lib') in
    > /home/users/peter/public_html/events/users/logon.php on line 13
    >
    > But during testing the same code on localhost I had no problems. Where
    > is the problem and how to solve it? Do I have to define include_path?
    >
    > Thanks
    >
    > Peter[/color]

    It seems to me, that you've used backslashes in your path? To include files
    on Linux you'll have to use slashes like
    '/home/users/peter/puplic_html/includes/db.php' or something that way...

    Patrick

    Comment

    • Bromus

      #3
      Re: Problem with include

      Patrick Trettenbrein <patrick.trette nbrein@gmail.co m> wrote in message news:<319jilF36 mugcU1@individu al.net>...[color=blue]
      > Bromus wrote:
      >[color=green]
      > > Hi,
      > >
      > > When I try to use include with relative path, I've got the error:
      > >
      > >
      > > Fatal error: main(): Failed opening required '..\includes\db .php'
      > > (include_path=' .:/home/lib') in
      > > /home/users/peter/public_html/events/users/logon.php on line 13
      > >
      > > But during testing the same code on localhost I had no problems. Where
      > > is the problem and how to solve it? Do I have to define include_path?
      > >
      > > Thanks
      > >
      > > Peter[/color]
      >
      > It seems to me, that you've used backslashes in your path? To include files
      > on Linux you'll have to use slashes like
      > '/home/users/peter/puplic_html/includes/db.php' or something that way...
      >
      > Patrick[/color]

      You are perfectly right! I have noticed it today morning - sometimes
      when solution is very simple you can't see it. This was my case - I
      dug too deep. Thank you for help

      Peter

      Comment

      • Keltex

        #4
        Re: Problem with include

        Hi

        Also thanks from me. I had the same problem too.
        It appears to me that not only the relative path but the whole directory
        path at your service provider is necessary.

        Keld


        "Patrick Trettenbrein" <patrick.trette nbrein@gmail.co m> wrote in message
        news:319jilF36m ugcU1@individua l.net...[color=blue]
        > Bromus wrote:
        >[color=green]
        > > Hi,
        > >
        > > When I try to use include with relative path, I've got the error:
        > >
        > >
        > > Fatal error: main(): Failed opening required '..\includes\db .php'
        > > (include_path=' .:/home/lib') in
        > > /home/users/peter/public_html/events/users/logon.php on line 13
        > >
        > > But during testing the same code on localhost I had no problems. Where
        > > is the problem and how to solve it? Do I have to define include_path?
        > >
        > > Thanks
        > >
        > > Peter[/color]
        >
        > It seems to me, that you've used backslashes in your path? To include[/color]
        files[color=blue]
        > on Linux you'll have to use slashes like
        > '/home/users/peter/puplic_html/includes/db.php' or something that way...
        >
        > Patrick
        >[/color]


        Comment

        • Erwin Moller

          #5
          Re: Problem with include

          Keltex wrote:
          [color=blue]
          > Hi
          >
          > Also thanks from me. I had the same problem too.
          > It appears to me that not only the relative path but the whole directory
          > path at your service provider is necessary.
          >
          > Keld
          >[/color]

          I don't think so Keltex.
          Relative includes works perfectly fine for me.
          Both at my provider or at my developmentmach ine.
          Both on W$ and on Linux.

          But if your includes work now: great.
          If it ain't broke, don't fix it.

          But I prefer relative paths wherever possible.
          Makes it so much easier to move stuff around.

          Regards,
          Erwin Moller

          Comment

          • Chuck

            #6
            Re: Problem with include

            Not sure this is you problem - but I've had the same type of problem.
            You said ".. on localhost" - so I assume that you're then ftp'ing
            the code to a hosting machine. Depending on the set up there you're
            going to have to do: include ("/host14/vm7/abc123/home/users/peter...");
            because the "real" path to you file is not you think it is.

            Rots'a'ruck

            Bromus wrote:[color=blue]
            > Hi,
            >
            > When I try to use include with relative path, I've got the error:
            >
            >
            > Fatal error: main(): Failed opening required '..\includes\db .php'
            > (include_path=' .:/home/lib') in
            > /home/users/peter/public_html/events/users/logon.php on line 13
            >
            > But during testing the same code on localhost I had no problems. Where
            > is the problem and how to solve it? Do I have to define include_path?
            >
            > Thanks
            >
            > Peter[/color]

            Comment

            Working...