3

I'm trying to manage my remote shared hosting WordPress installation via WP-CLI installed on my local Windows machine. So far I have managed to install WP-CLI (The "WP" command is available to run).

But when I try and connect to a remote URL with "wp --http", I get the following messsage:

 RESTful WP-CLI needs to be installed. Try 'wp package install wp-cli/restful'

So I run the suggested command and I get:

Composer directory for packages couldn't be created.

I hadn't installed via composer. Instead, I manually instaled PHP and then downloaded the "wp-cli.phar" file. So I tried to install composer on Windows, but couldn't make head or tail of what downloads where. I "think" I managed to install wp-cli, but couldn't see where it had installed the files...and it just didn't work out.

Do you guys know of a more straightforward way to do this?

Bhagwad Jal Park
  • 1,093
  • 1
  • 13
  • 22

1 Answers1

0

Concerning the error: Composer directory for packages couldn't be created.

If you did not set the environment variable WP_CLI_PACKAGES_DIR the default is ~/.wp-cli/packages/ which works for Linux but not for Windows.

I set this variable and the command 'wp package install wp-cli/restful' now successfully creates the directory for packages and the composer.json file but still doesn't install wp-cli/restful.

So I used composer directly and it successfully installs wp-cli/restful.

If I use the parameter --http=me.local.com (which matches example in the documentation) I get the error "Couldn't auto-discover WP REST API endpoint from me.local.com.' However, if I change this to --http=me.local.com/wp-json it works. The actual command I used is:

wp --http=me.local.com/wp-json rest post list