Wp search-replace cli not working. How to change domain name

I run the below code to change my domain name from the old one to the new one,

 wp search-replace 'old domain' 'new domain' --verbose --dry-run

But the following error occurs…

PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 110
PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 124
PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 125
PHP Warning:  Use of undefined constant WP_CONTENT_DIR - assumed 'WP_CONTENT_DIR' (this will throw an Error in a future version of PHP) in /var/lib/docker/volumes/ugondiomacom_htdocs/_data/htdocs/wp-includes/load.php on line 141
Error: Your PHP installation appears to be missing the MySQL extension which is 

I’m thinking of installing an extension, but two things are in my mind.

  1. Easyengine is to be installed on plain OS without prior installation on it. If I install an extension as wp cli requires, will it conflict with easyengine?
  2. WP CLI does not specify which extension it needed to successfully sun search and replace.

What do I need to properly use WP CLI? Most importantly, I want to change my domain name from olddomain to newdomain.

I tried to follow instruction from @gua1991 as he described here ===> Domain change for functioning WP Multisite network with subfolders but running the first command he recommended does not work.

ee site edit olddomain.com
Error: 'edit' is not a registered subcommand of 'site'. See 'ee help site' for available subcommands.

Any help please!

Finally!

I dogged it out after days of searching.

Sorry, is not long I posted this topic and found the solution I have been looking for so long.

The simple solution is to run

sudo ee shell domain

And you will be in for wp cli, then from there, you can run all your command.

The solution was found here ===> How to use WP-CLI with EasyEngine 4

1 Like