Public bug reported:

$ sudo wp option update home "http://localhost"; --allow-root
PHP Notice:  Undefined index: HTTP_HOST in 
phar:///data/local/bin/wp/php/WP_CLI/Runner.php(1070) : eval()'d code on line 10
Neither <b>/etc/wordpress/config-.php</b> nor <b>/etc/wordpress/config-.php</b> 
could be found. <br/> Ensure one of them exists, is readable by the webserver 
and contains the right password/username.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following code should be added to /usr/share/wordpress/wp-config.php
so as to facilitate wp-cli usage, as delineated here:
https://make.wordpress.org/cli/handbook/common-issues/#php-notice-
undefined-index-on-_server-superglobal

if ( defined( 'WP_CLI' ) && WP_CLI && ! isset( if ( defined( 'WP_CLI' ) && 
WP_CLI && ! isset( $_SERVER['HTTP_HOST'] ) ) {
    $_SERVER['HTTP_HOST'] = 'wp-cli.org';
}

root@yellow:/usr/share/doc/wordpress# lsb_release -rd
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
root@yellow:/usr/share/doc/wordpress# apt-cache policy wordpress
wordpress:
  Installed: 4.4.2+dfsg-1ubuntu1
  Candidate: 4.4.2+dfsg-1ubuntu1
  Version table:
 *** 4.4.2+dfsg-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: wordpress 4.4.2+dfsg-1ubuntu1
ProcVersionSignature: Ubuntu 4.4.0-98.121-generic 4.4.90
Uname: Linux 4.4.0-98-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.10
Architecture: amd64
CurrentDesktop: Unity
Date: Mon Nov  6 13:24:11 2017
InstallationDate: Installed on 2017-10-13 (24 days ago)
InstallationMedia: Ubuntu 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
PackageArchitecture: all
SourcePackage: wordpress
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: wordpress (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug xenial

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1730522

Title:
  Undefined index: HTTP_HOST; wp-config.php wrong for wp-cli

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/wordpress/+bug/1730522/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to