473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Jul 17 '05 #1
5 1554
Bromus wrote:
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


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

Jul 17 '05 #2
Patrick Trettenbrein <pa******************@gmail.com> wrote in message news:<31*************@individual.net>...
Bromus wrote:
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


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


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
Jul 17 '05 #3
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" <pa******************@gmail.com> wrote in message
news:31*************@individual.net...
Bromus wrote:
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
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

Jul 17 '05 #4
Keltex wrote:
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


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
Jul 17 '05 #5
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:
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


Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: James Aguilar | last post by:
Hello all, I am trying to use an istringstream to do some input off of cin by lines. The following snippet does not work: char buf; cin.getline(buf, 90); istringstream line1(string(buf));
7
by: for.fun | last post by:
Hi everybody, I have the following problem : B class need A::MyEnum type and A class need B::MyEnum type. In both case, the class type is incomplete so it is obvious that the ::MyEnum can not...
14
by: main() | last post by:
I know this is the problem that most newbies get into. #include<stdio.h> int main(void) { char a; scanf("%c",&a); /*1st scanf */ printf("%c\n",a); scanf("%c",&a); /*2nd scanf*/...
6
by: +86 | last post by:
i encountered this problem: "include('inc.php')" will work problely but "include('./inc.php') doesn't work .. both file_exists('inc.php') or file_exists('./inc.php') didn't return the right...
7
by: T.A. | last post by:
Class hierarchy below demonstrates my problem: #include <vector> #include <boost/smart_ptr.hpp> class Fruit { public: virtual ~Fruit() = 0; };
5
by: Michael | last post by:
Hi All, I've wasted heaps of time today trying to get some code I copied from a text to compile. I have cut it down to the following couple of lines which demonstrate the core of the problem: ...
9
by: Eric Lilja | last post by:
Hi! I have a program with a class that needs to be able to write itself to a file in clear text format. The file has two integers and vector of struct objects. The struct has a string that can...
3
by: suman das | last post by:
slove this problem include<stdio.h> include<conio.h> void main() { int i=1; printf("%d",i++*++i); getch(); }
18
by: MZaza | last post by:
Hello, When I compile it I get an error in line 16, which got case 'c'. #include <cstdlib> #include <iostream> #include <math.h> using namespace std; int main()
4
by: alexjcollins | last post by:
The following program demonstrates the problem: #include <vector> #include <iostream> #include <tvmet/Vector.h> typedef tvmet::Vector<double, 3Vector3d; class Mesh {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.