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.
When I'm writing javascript on pages, I can reference other pages based on the site root, like this:
include '/includes/something.js';
But I can't do the same thing in PHP. If I want to include a file in PHP code, I need to type:
include '/var/www/site_name/includes/something.php';
(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 https://phplist.mydomain.org/var/www/phplist/admin/?page=configure - which of course gives me a 'Page not found' error.
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.
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?
<VirtualHost 95.102.96.250:443>
ServerName phplist.mydomain.org
DocumentRoot /var/www/phplist
ServerAdmin admin@mydomain.org
<Directory /var/www/phplist/>
Options +FollowSymLinks
AllowOverride All
order allow,deny
allow from all
</Directory>
</VirtualHost>
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!