wp-cli gives an error
-
on every wp-cli command I get the following message:
PHP Notice: Undefined index: HTTP_HOST in /var/www/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 4
Which is:
$WPSC_HTTP_HOST = htmlentities( $_SERVER[ 'HTTP_HOST' ] );
Of course the host isn’t defined on a cli script.
I’ve been using this fix for a while now and I found no problems with is.
It works on sub folder installs and on sub domains.
I have not tested it with a multisite.
if (isset($_SERVER[ ‘HTTP_HOST’ ])){
$WPSC_HTTP_HOST = htmlentities( $_SERVER[ ‘HTTP_HOST’ ] );
} else {
$home_url = explode(‘/’, home_url(‘/’));
$WPSC_HTTP_HOST = htmlentities($home_url[2]);
}
- The topic ‘wp-cli gives an error’ is closed to new replies.