• Resolved georgepennet

    (@georgepennet)


    Im trying to flush cache using wp w3-total-cache flush all. I logged in via SSH to my AWS I’m in directory where wordpress is installed. I used the command and I receive this error –

    PHP Notice:  Undefined index: HTTP_X_FORWARDED_PROTO in phar:///opt/bitnami/apps/wordpress/bin/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 1
    Success: Everything flushed successfully.

    Cache is not flushed. Any idea how to resolve this?
    I want to create a bash file and run a cron job to clear cache on midnight every day.

    If there is any alternative way you could provide me I would be grateful. I know you can call a php function but I really not sure how this should be done here.. Where should I add this?

    // Flush W3TC Cache
    function tj_flush_w3tc_cache() {
    $w3_plugin_totalcache->flush_all();
    }

    And next how to trigger it via sh file?

    Btw I want a cronjob on a server not on wp.

    • This topic was modified 2 years, 1 month ago by georgepennet.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @georgepennet

    Thank you for reaching out and I am happy to assist you with this.

    What you may have to try to do is check that the index exists and then set it as required. Updated your?wp-config.php?file to look like this.

    
    define('FORCE_SSL_ADMIN', true);
    define('FORCE_SSL_LOGIN', true);
    if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){ $_SERVER['HTTPS']='on'; }

    Once you have added the array key check it’ll work correctly both for the site itself and for wp-cli.

    I hope this helps!

    Thread Starter georgepennet

    (@georgepennet)

    I don’t have error now but it seems it still doesn’t work from terminal. Any other method?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @georgepennet

    Thank you for your feedback.

    Can you please let me know how you confirmed that the cache is not flushed?

    You can always call w3tc_flush_all();
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can’t flush cache’ is closed to new replies.