I used to have my website into a domain like : www.mydomain.com
But now i've created a subdomain 'test' : www.test.mydomain.com
and i moved the whole project files there.
So far so good, the problem is that on my php libraries where i call db connection etc, i use the $_SERVER['DOCUMENT_ROOT']
which gives me the URL without the subdomain , e.x.
$file = $_SERVER['DOCUMENT_ROOT'];//gives me www.mydomain.com
But i need to get the root with the subdomain, like : www.test.mydomain.com
I dont want to make a trick like to split the url and add the subdomain thing.
Any help would be appreciated.