Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

New at this, so apologies if I'm not using the correct terminology, but... Locally, in my scripts, I can include scripts using:


And it will automatically traverse to my web directory for inclusion... However, when I upload it to my server, it uses the server root at "/".

I don't really know what to search for, otherwise, I'd google, it, but hoping someone knows what I need to change on the server?

share|improve this question
You need to consider that an include statement uses file paths, not URLs. The root as the web server sees it is not the same as the file system root. In general it's a bad idea to use absolute paths in PHP, unless you do so using variables, as per Brett's answer. If nothing else, absolute paths break portability. – John Gardeniers Sep 17 '12 at 23:38

Instead of modifying the php.ini you might consider modifying your include. You could use a relative path like:


or you could use an absolute path like:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.