Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with include

Bromus
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

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

Bromus
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Problem with include


Patrick Trettenbrein <patrick.trettenbrein@gmail.com> wrote in message news:<319jilF36mugcU1@individual.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
Keltex
Guest
 
Posts: n/a
#4: Jul 17 '05

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.trettenbrein@gmail.com> wrote in message
news:319jilF36mugcU1@individual.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]


Erwin Moller
Guest
 
Posts: n/a
#5: Jul 17 '05

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 developmentmachine.
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
Chuck
Guest
 
Posts: n/a
#6: Jul 17 '05

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]

Closed Thread