Skip to content

Instantly share code, notes, and snippets.

Last active September 29, 2016 18:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Determine the server and web directory of the current file.
* set the server directory that this application is stored in.
* if applicaiton is in the root directory, set to "/"
$_app_server_path = rtrim(str_replace('\\', '/', dirname(__FILE__)),"/")."/"; // eg: "/home/ubuntu/workspace/my-website/"
$web_app_path = str_replace(rtrim($_SERVER['DOCUMENT_ROOT'],"/"),'',$_app_server_path); // eg: "/my-website/" or just "/" if in root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment