phpincludeini-set

how to to include a file from main domain to subdomain


want to include a file from main domain to subdomain

index.php - on subdomain.example.com

ini_set("allow_url_fopen", 1);
ini_set("allow_url_include", 1);    
$host = $_SERVER['HTTP_HOST'];
if($host == 'localhost'){include("../navt.php");}
else{include("https://example.com/navt.php");}

on localhost - there is no problem (win 10, xampp, chrome)
on remote server - I'm still getting this:
include(): https:// wrapper is disabled in the server configuration by allow_url_include=0


Solution

  • The documentation for the allow_url_include setting includes two important details:

    Both of these are for the same reason: this setting is extremely dangerous. It's highly advisable to come up with an alternative solution to your problem, by thinking about how you deploy your code. For instance: