title: How do I link JS external files outside of my PHP project root directory?
body: <p>On my site I have my resources folder outside of the root, for example:</p>
  <blockquote>
  <p><code>/var/www/html/</code> is the root directory</p>
  <p><code>/var/www/resources/</code></p>
  </blockquote>
  <p>I currently have a config file that sets the location of the library so I can include it with php like so:</p>
  <pre><code>defined(&quot;LIBRARY_PATH&quot;)  
  
  or 
  
  define(&quot;LIBRARY_PATH&quot;, realpath(dirname(__FILE__) . '/library'));
  </code></pre>
  <p>which works perfectly when I use:</p>
  <pre><code>&lt;?php include_once(LIBRARY_PATH . &quot;/file.php&quot;); ?&gt;
  </code></pre>
  <p>but it doesn't work when trying to add Javascript files:</p>
  <p>e.g.</p>
  <pre><code>&lt;script src=&quot;../resources/library/js/test.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>links to 'www.website.com/resources/library/js/common.js'
  or</p>
  <pre><code>&lt;script src=&quot;&lt;?php echo LIBRARY_PATH; ?&gt;/js/test.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>links to 'www.website.com/var/www/resources/library/js/test.js'</p>
  <p>neither of which work.</p>
  <p>Any suggestions on how I can do this without having the js files in or above the root?</p>