I set up my computer as a local testing server (OSX with apache and PHP) and via Dreamweaver I can now test my sites locally.
I am encountering one problem though:
a lot, as a convenient way to get my paths right.
for example, I would use
The problem is, when I test locally, I get the error message:
Warning: main() [function.include]: Failed opening '/Library/WebServer/Documents/includes/top.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /Users/seb/Sites/blablabla...
Why is there an error, and can I remedy this, without having to change my use of $_SERVER['DOCUMENT_ROOT'] in all my sites?
Try defining a VirtualHost section for the test site with the DocumentRoot properly defined. This all depends on how you've configured apache. Maybe you're getting to the actual file being served through an Alias?
By the way this isn't very helpful:
It's kind of important here.
Atealtha, and HardCoded,
no, 'Library/WebServer/Documents/includes/' is not the directory I want (I have no idea where that path comes from). The directory I want is:/Users/seb/Sites/blablabla...
(where blablabla is the name of the folder that contains that specific sites. I put all my sites in 'Sites').
Actually, when I think of it, the error message I get shows exactly the problem by itself:
on one hand, it says:
Failed opening '/Library/WebServer/Documents/includes/top.php'
on the other hand, it says:
for inclusion in /Users/seb/Sites/blablabla...
so when the error message wants to tell me the path that results from calling $_SERVER['DOCUMENT_ROOT'] it returns '/Library/WebServer/Documents/includes/top.php', which is WRONG
but when it tells me the path to the page I call the include function from, it returns
'/Users/seb/Sites/blablabla...' which is RIGHT
Obviously, '/Library/WebServer/Documents/includes/top.php' SHOULD be '/Users/seb/Sites/blablabla/includes/top.php'
/Users/seb/Sites/blablabla/ IS the document root.
And it KNOWS it, since it gives me the right path to my page accroding to its root: