1

I have a really basic function that I started. I began very simple with in code/Page.php:

public function createGreeting() {
    return 'hi';
}

In my Page.ss template, I have the variable: <% $createGreeting %>

Yet, this is killing the page. I checked the error logs, and it is showing:

PHP message: PHP Warning:  Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set. in /usr/share/nginx/html/lungmap/framework/control/Director.php on line 488" while reading upstream, client: 31.210.102.114, server: 52.90.93.59, request: "GET / HTTP/1.0", upstream: "fastcgi://unix:/var/run/php/php5.6-fpm.sock:" 2017/06/12 12:34:50 [error] 1730#0: *6682 FastCGI sent in stderr: "PHP message: PHP Warning:  Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set. in /usr/share/nginx/html/lungmap/framework/control/Director.php on line 488

Any idea what could be causing this? If I remove that line from Page.ss, the page loads perfectly fine.

yondaimehokage
  • 243
  • 2
  • 15
  • Can you share your nginx configuration? Did you use the [example in the docs](https://docs.silverstripe.org/en/3/getting_started/installation/how_to/configure_nginx/) to start with, or roll your own? Anyway, it looks like nginx isn't setting the [`$http_host` parameter](https://stackoverflow.com/questions/15414810/whats-the-difference-of-host-and-http-host-in-nginx) correctly. – scrowler Jun 12 '17 at 21:37

1 Answers1

6

You shouldn't wrap the variable in a <% %> block, but rather, just call it.

Simon Erkelens
  • 762
  • 4
  • 8