Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set

二次信任 提交于 2019-12-11 06:18:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!