views:

299

answers:

2
Warning: include(/2008/2009/assets/inc/base/error.inc.php) [function.include]:
failed to open stream: No such file or directory in
C:\Program Files\Apache Group\Apache2\htdocs\2008\2009\assets\inc\base\header.inc.php on line 82

I am receiving the above error when including a file on a WAMP setup. Is it possible that Windows is interpreting the /2008/ to mean c:/2008 rather than the actual http://localhost/2008?

To give a bit more detail, I have a constant defined as ROOT that I use all over my site. (ROOT in this instance is set to /2008/2009/). I use ROOT before paths for images, links, css files, include/require files, etc. The CSS and links are properly scaling to localhost/2008/2009, but include files are not being found.

Any help would be greatly appreciated.

PS php.ini has include path defined as:

include_path = C:\Program Files\Apache Group\Apache2\htdocs"

Update

I was using URL rewriting to change item/x to item-display.php?id=x, this change in folders is what ROOT was built off of. This made anything displayed to the browser (imgs, links, etc) all work flawlessly, but made anything internal not work, as item-display.php is actually one folder down. I moved item-display.php to an item folder, and this made the actions consistent both client side and server side.

+3  A: 

You’re using an absolute path rather than a relative path.

Gumbo
I was under the impression that absolute paths are acceptable in includes?
Cory Dee
They are accepted but just as “fixed values”. So they are not resolved using the include path as they are already absolute.
Gumbo
A: 

If you are using the include path, you have to specify a relative URL, starting with the first directory or ./. Btw, you should define your path with something like dirname(__FILE__) in a file whose position in your project is not going to change or by looking into server. Otherwise, installing your application on another server is going to be unnecessarily complicated.

phihag
I think we're on the same page here. Currently, installing to another server is as simple as opening /assets/inc/settings.inc.php and changing the value of ROOT, and it's now done site wide. I'm now attempting to switch from rel to abs to sidestep URL rewriting issues (fake directories).
Cory Dee