So you have two separate configurations for two separate domains pointing to the same virtual root? If they point to different virtual roots than I can't imagine why this is a PHP issue, perhaps you can elaborate. Just guessing, I'd assume you just need to use an absolute path when you do the file_exists and is_readable checks. See realpath for information on how to find each website's absolute path. Note, even then you may have issues with is_ readable because they technically shouldn't be readable to each other (permissions setup for a good reason.)