问题
I'm getting the following error:
PHP Warning: Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set. in /<path/to/project>/framework/control/Director.php on line 488
But, when I add print_r($_SERVER['HTTP_HOST']);
to mysite/_config.php I get the appropriate url.
Any ideas what this could be? It started suddenly yesterday after weeks of developing on the same host. It's only happening on my remote environment. Local works fine. I haven't made any config changes.
I've looked at this post on SS forums, as well this tiny post since I am using a continuous deployment system, but neither have helped me so far.
Any ideas what this could be or where I should be looking? Many thanks.
My project uses:
- SilverStripe 3.6.0
- PHP 5.5.9
- Apache 2.4.7
回答1:
I got that same problem. To fix that, I have added below piece of code in _ss_environment.php or mysite/_config.php file.
global $_FILE_TO_URL_MAPPING;
$_FILE_TO_URL_MAPPING[__DIR__] = 'http://example.com';
来源:https://stackoverflow.com/questions/44956081/directorprotocolandhost-lacks-sufficient-information-http-host-not-set