Q:

php require() weird conflict

Okay.
I have this big folder WEBSITE
in it I have classes folder , includes folder and a index.php file 
->->
In the includes folder I have a config.php . This file is being required by index.php(from the main folder) like this:
require('includes/config.php');

In config.php I also have this:
 include('classes/user.php');
include('classes/phpmailer/mail.php');

The thing is when I open index.php , everything works.But if I open includes/config.php I'm getting the No such file or directory error that is obvious because normally  , my path should be 
include('../classes/user.php');
    include('../classes/phpmailer/mail.php');
but that would end up in my index.php file not working by telling me the two includes above can't be found.
Is there a proper way in achieving what I want ? 
Thank you.

A:

Use absolute paths when including files:
 include($_SERVER["DOCUMENT_ROOT"] . "/classes/user.php");

or
 include(__DIR__ . "/../classes/user.php");

