Director :: protocolAndHost()缺少足够的信息-未设置HTTP_HOST [英] Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set
问题描述
我遇到以下错误:
PHP警告:Director :: protocolAndHost()缺少足够的信息-未设置HTTP_HOST.在第488行的/<path/to/project>/framework/control/Director.php中
但是,当我将 print_r($ _ SERVER ['HTTP_HOST']);
添加到 mysite/_config.php 时,我得到了适当的URL.
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.
我看过此帖子在SS上论坛,以及这篇小贴子因为我使用的是连续部署系统,但到目前为止,都没有帮助我.
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.
我的项目使用:
- SilverStripe 3.6.0
- PHP 5.5.9
- Apache 2.4.7
推荐答案
我遇到了同样的问题.为了解决这个问题,我在_ss_environment.php或mysite/_config.php文件中添加了以下代码.
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';
这篇关于Director :: protocolAndHost()缺少足够的信息-未设置HTTP_HOST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!