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.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • Reddit
  • Furl
  • NewsVine
  • Simpy
  • Slashdot
  • Spurl
  • StumbleUpon
  • YahooMyWeb
  • TailRank

Home | PHP | Include Path