user2648839
user2648839

Reputation:

Not allowed to load local resource use $_SERVER['DOCUMENT_ROOT']

Hello everyone I was to trying to set up a variable that store my main directory to save time. I know the problem is something to do with file:// is there anyway round this like changing the file:// into http://?

$Root_Path =  $_SERVER['DOCUMENT_ROOT']."/Website";

Upvotes: 0

Views: 4449

Answers (1)

Emilio Gort
Emilio Gort

Reputation: 3470

try to use:

$Root_Path = "http://".$_SERVER['SERVER_NAME']."/Website";

Output:

http://yourserver.com/website/

UPDATE:

If you really want to get the root, use only:

$Root_Path = "http://".$_SERVER['SERVER_NAME'];

Output:

http://yourserver.com/

Upvotes: 2

Related Questions