title: Absolute path issues in PHP on localhost in OS X
body: <p>I'm having some issues with defined absolute paths in PHP. <strong>I define the</strong> <code>SITE_ROOT</code> <strong>and</strong> <code>APP_PATH</code> like so:</p>
  
  <pre><code>defined('SITE_ROOT') ? null : 
  define('SITE_ROOT', str_replace('//','/',dirname(__FILE__)) );
  
  defined('APP_PATH') ? null : define('APP_PATH', SITE_ROOT.DS.'application');
  </code></pre>
  
  <p><strong>When using the</strong> <code>APP_PATH</code> in an application like so:</p>
  
  <pre><code>echo APP_PATH;
  </code></pre>
  
  <p>...this is <strong>what I get</strong>:</p>
  
  <pre><code>/Users/user/Sites/MyWebsite/application
  </code></pre>
  
  <p><strong>What I want</strong> is for the output to be:</p>
  
  <pre><code>localhost/application
  </code></pre>
  
  <p><strong>Is there any non-kludgy way of doing this?</strong></p>
  
  <p>My use case is to use the <code>APP_PATH</code> (already in use for doing all my <code>require()</code>'s) echoed out with HTML to avoid relative pathing problems within URLs for <code>href</code>'s.</p>