• Resolved thartl

    (@hartl)


    Hello, I have been noticing php warnings on local and staging sites, and now also when running WP CLI commands.

    It’s just a warning, but I thought I’d mention it.

    “Warning: Undefined array key “HTTP_HOST” in /wp-content/plugins/wp-cloudflare-page-cache/libs/html_cache.class.php on line 79″

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @hartl,
    Please contact your host and ask them why $_SERVER['HTTP_HOST'] is not returning a value. It is supposed to as it is a global server variable.

    Thread Starter thartl

    (@hartl)

    Hi @isaumya,
    thank you for your reply. I run my own VPS and as far I can tell $_SERVER['HTTP_HOST'] is available from well before init to shutdown. Actually I can var_dump it just before line 79 of html_cache.class.php on every page request.
    Also I don’t see anything in the codebase that would reset it.
    Hmm, mysterious…

    denisvopros

    (@denisvopros)

    I have the likely problem:

    PHP Warning:  Undefined array key “HTTP_HOST” in /var/www/mysite.com/html/wp-content/advanced-cache.php on line 12

    PHP Warning:? Undefined array key “HTTP_HOST” in /var/www/mysite.com/html/wp-content/advanced-cache.php on line 13

    In the file –?advanced-cache.php:

    Line 12:
    $swcfpc_fallback_cache_config_path = WP_CONTENT_DIR . “/wp-cloudflare-super-page-cache/{$_SERVER[‘HTTP_HOST’]}/”;

    Line 13:
    $swcfpc_fallback_cache_path = WP_CONTENT_DIR . “/wp-cloudflare-super-page-cache/{$_SERVER[‘HTTP_HOST’]}/fallback_cache/”;

    How to fix this?

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @denisvopros & @hartl,
    Can you please try the following? Create a test.php file and put the following inside the file:

    <?php
    echo $_SERVER['HTTP_HOST'];

    Then save the file and upload it to your server’s root folder where you have the wp-config.php file. Then access this file with https://yourdomain.com/test.php and then please share the output that you get.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP warning’ is closed to new replies.