Skip to content

Instantly share code, notes, and snippets.

@micah1701
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
Embed
What would you like to do?
Determine the server and web directory of the current file.
<?php
/**
* 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
define('_app_path',$web_app_path);
define('_app_server_path',$_app_server_path);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment