title: WP CLI avoid 'Undefined index: HTTP_HOST' when using http_host in wp-config.php
body: <p>I am confronted to the error <code>PHP Notice:  Undefined index: HTTP_HOST</code> when trying to use wp-cli on my wordpress install because I have this line in my wp-config.php:</p>
  
  <pre><code>define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
  </code></pre>
  
  <p>Bug is reported here <a href="https://github.com/wp-cli/wp-cli/issues/730" rel="nofollow noreferrer">https://github.com/wp-cli/wp-cli/issues/730</a> and there is a solution here <a href="https://make.wordpress.org/cli/handbook/common-issues/#php-notice-undefined-index-on-_server-superglobal" rel="nofollow noreferrer">https://make.wordpress.org/cli/handbook/common-issues/#php-notice-undefined-index-on-_server-superglobal</a> which is to set a default value in wp-cli context:</p>
  
  <pre><code>if ( defined( 'WP_CLI' ) &amp;&amp; WP_CLI &amp;&amp; ! isset( $_SERVER['HTTP_HOST'] ) ) {
      $_SERVER['HTTP_HOST'] = 'example.com';
  }
  </code></pre>
  
  <p>I don't understand this solution though. Isn't the point of <code>$_SERVER['HTTP_HOST']</code> NOT to have to set a value for the current domain name? Or does this example mean that I can put ANY value for <code>$_SERVER['HTTP_HOST']</code>, no matter my real domain name, as it won't be used by wp-cli?</p>