Question

On a php file I have

include_once($_SERVER['document_root'] .'/path/to/file.php');

When I'm viewing the file which has the code in for example test.php, if I have this URL formatting it works fine:

http://www.example.com/path/to/test.php

But if it's a subdomain, like this:

http://path.example.com/to/test.php

I get an error saying the path to file.php that is included into the file does not exist.

I've tried putting in a full url include_once('http://www.example.com/path/to/file.php');.

How can I get this to work under subdomains?

Was it helpful?

Solution

Use the file-systempath. You cannot include from other URL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top