# Thread: Problem locating files in file system using php.

1. Registered User
Join Date
May 2003
Location
Florida
Posts
41

## Problem locating files in file system using php.

I am building a site using WAMP in windows 7 and I am having problems locating my css and image folder in my sub directories.

I have multiple index.php files. I have 1 index.php file in the root of my site and also multiple sub folders which their own index.php file as well. I am using the "require_once" function to include header.php, footer.php, sidebar.php, etc and and all my index.php files are using these same included files regardless what level they're in in my folder tree.

The problem is with my header.php file; because that is the file I'm using to link to my css stylesheet. I am successfully able to find the css file in my root index.php file but all my sub-folder index.php files ere not finding it.

I've already discovered that by going into my header.php file and put a "../" in front will successfully work for all my sub-folder index.php files, but then my root index.php file doesn't find the css stylesheet anymore, and visa-versa.

How can I get all my index.php files to see the css file regardless how deep or shallow they are in my file directory?

I already know how to solve this problem if my site was already live on the internet, but I don't know how to solve it while I'm building it locally in WAMP. Can someone please help me? I hope I didn't confuse anyone...

2. PHP Code:
 include \$_SERVER['DOCUMENT_ROOT'] . '/path/to/file.php';  
So if, for instance, you have your WAMP config set up such that your web document root is at C:\Wamp\www, that would look for the include file as C:\Wamp\www\path\to\file.php.