title: Apache & PHP: DocumentRoot isn't working as expected
body: <p>I'm working with a LAMP server with several sites configured as subdomains in Apache. As standard, each site/subdomain lives in a tidy directory inside /var/www/. I've told Apache where each site lives in the /etc/apache2/sites-available/ config files, using several VirtualHosts and specifying DocumentRoot and ServerName for each.</p>
  
  <p>When I'm writing javascript on pages, I can reference other pages based on the site root, like this: </p>
  
  <pre><code>include '/includes/something.js';
  </code></pre>
  
  <p>But I can't do the same thing in PHP. If I want to include a file in PHP code, I need to type: </p>
  
  <pre><code>include '/var/www/site_name/includes/something.php';
  </code></pre>
  
  <p>(I can still do relative references, such as ../includes/something.php, but that's beside the point here.) I was confused on why I would need the /var/www/, but up to now it was just an annoyance. I could code around it, once I figured out that the full directory was needed. But now I'm trying to install PHPlist, and every time I save a setting, I'm redirected to a URL like <a href="https://phplist.mydomain.org/var/www/phplist/admin/?page=configure" rel="nofollow">https://phplist.mydomain.org/var/www/phplist/admin/?page=configure</a> - which of course gives me a 'Page not found' error.</p>
  
  <p>It looks like something is messed up about how my Apache / PHP setup treat the site root. I haven't dug into the PHPlist code, and don't particularly want to. But I assume that if I can fix my settings such that I can include files in PHP without needing the /var/www/ prefix, then PHPlist will also stop giving me over-prefixed URLs.</p>
  
  <p>For reference, here's how most of my Apache virtual hosts look. I guess my specific questions are: 1) do you see anything in what I've told you, that needs correcting? 2) where would you look or what would you try next to figure out this weirdness?</p>
  
  <pre><code>&lt;VirtualHost 95.102.96.250:443&gt;
    ServerName phplist.mydomain.org
    DocumentRoot /var/www/phplist
    ServerAdmin admin@mydomain.org
  
    &lt;Directory /var/www/phplist/&gt;
      Options +FollowSymLinks
      AllowOverride All
      order allow,deny
      allow from all
    &lt;/Directory&gt;
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Hopefully this is just a basic misunderstanding on my part. I've tried RingTFM but haven't been able to figure out what's happening here. Thanks in advance!</p>