Include Path

Often times you need to use the complete include path, not just the relative path. You can discover the complete include path, even if you are on a shared host, by examining the $_SERVER array. The SCRIPT_FILENAME value is the complete path to the file that is calling it. So an easy way to see what the full path to a file is to put this line of code at the top of a file:

echo $_SERVER['SCRIPT_FILENAME'];

Now you know the complete path to where you are working with the files at. You can use the base include path in your classes or whatever.

  • Digg
  • TwitThis
  • del.icio.us
  • Netvouz
  • description
  • Reddit
  • Furl
  • NewsVine
  • Simpy
  • Slashdot
  • Spurl
  • StumbleUpon
  • YahooMyWeb
  • TailRank
  • Technorati
  • Facebook
  • Google
  • LinkedIn
  • Live
  • MySpace
  • Ping.fm
  • Yahoo! Buzz
  • E-mail this story to a friend!



Home | PHP | Include Path