Installing WP Cli on Plesk server

  • by

Hello fiends lets get started.

First of all you need SSH with root of Plesk Server.

Login as root goto /tmp folder.

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

now after when u use command like wp find 

it will not work

you have to install find command with this command

wp package install wp-cli/find-command

which will also not work and give u memory error.

for that goto /etc/php.ini

edit it and find memory_limit = 128M change it to memory_limit = 512M

no again try

wp package install wp-cli/find-command 

that sud work after this i got error while updating wordpess site

by this command.

wp core update --allow-root --path="/var/www/vhosts/
Error: The update cannot be installed because WordPress 5.2.3 requires PHP versi                                                                                                                                                             on 5.6.20 or higher. You are running version 5.4.16.</p><p><a href="https://word                                                                                                                                                   ">Learn more about updating PHP</a>.

This was very time consuming to solve this is the main solution found it working.

# Backup original php binaries
mv /usr/bin/php /usr/bin/php.backup
mv /usr/bin/php-cgi /usr/bin/php-cgi.backup
# mv /usr/bin/phpize /usr/bin/phpize.backup

# Create symlinks to the plesk php
ln -s /opt/plesk/php/5.6/bin/php /usr/bin/php
ln -s /opt/plesk/php/5.6/bin/php-cgi /usr/bin/php-cgi

after doing so all issues was solve and working happily with wp cli