The wp-cli.phar file is in the same directory from where I test the wp command. But it says the command doesn't exist.

When I'm trying to see if WP-CLI is installed with the php wp-cli.phar --info command, it looks like this:

root@new-web-node:/var/www/vhosts/mywebsite.com/httpdocs# php wp-cli.phar --info
OS: Linux 3.13.0-141-generic #190-Ubuntu SMP Fri Jan 19 12:52:38 UTC 2018 x86_64
Shell:  /bin/bash
PHP binary: /usr/bin/php5
PHP version:    5.5.9-1ubuntu4.23
php.ini used:   /etc/php5/cli/php.ini
WP-CLI root dir:    phar://wp-cli.phar
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /var/www/vhosts/mywebsite.com/httpdocs
WP-CLI packages dir:    
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 1.5.0

What is wrong? And how to fix it?

Sounds like you need to rename the wp-cli.phar to wp.

chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

I usually move wp to my home folder's bin directory so /home/YOUR_USER_NAME/bin

now try:

wp --info

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.