How to install wp-cli on smarthost.eu servers?

To install wp-cli you must first enable ssh access. Here is a guide on how to do that: Is SSH access available on hosting accounts?

IMPORTANT: ssh access works for all accounts. To get ssh access on a test account, contact us at hosting@smarthost.eu

Then on Windows, we log in to ssh using a client, e.g. PUTTY, it is free and can be downloaded from the website:

 https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Linux users can log in using the terminal using the command below:

ssh -p 5739 login@client-name.smarthost.eu

Install and run the program. We enter our cPanel login in the first field, then @, then the name of our account at Smarthost.eu. In the second field, enter port 5739.

First, make sure that you are in the default directory, e.g. /home/client-login, using the pwd command

Then download wp-cli with the wget command:

wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar



The next thing you need to do is edit the .bashrc. For this we can use the nano or mcedit editor. For the tutorial, I’ll use mcedit.

mcedit .bashrc

After executing the above command, the editor window should appear


Due to the ability to choose the PHP version on hosting accounts, you decide which PHP version wp-cli should use. For this purpose, we add a command alias to make it easier to navigate and choose the php version. The path /home/loginclient is the path where we downloaded the wp-cli. Important: You should only choose one from the list below, for the php version you are using and write it under

# User specific aliases and functions

PHP 5.6

alias wp='/opt/cpanel/ea-php56/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 7.0

alias wp='/opt/cpanel/ea-php70/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 7.1

alias wp='/opt/cpanel/ea-php71/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 7.2

alias wp='/opt/cpanel/ea-php72/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 7.3

alias wp='/opt/cpanel/ea-php73/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 7.4

alias wp='/opt/cpanel/ea-php74/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 8.0

alias wp='/opt/cpanel/ea-php80/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 8.1

alias wp='/opt/cpanel/ea-php81/root/usr/bin/php /home/clientlogin/wp-cli.phar'

PHP 8.2

alias wp='/opt/cpanel/ea-php82/root/usr/bin/php /home/clientlogin/wp-cli.phar'


Use the F2 key to save and then use F10 to exit the editor.

The last thing you need to do is load the configuration in the current session. New SSH sessions will automatically load the configuration.

. .bashrc


After all these steps, we can test the operation of wp-cli with the following command.

wp –info

OS: Linux 4.18.0-477.10.1.lve.el8.x86_64 #1 SMP Wed May 17 07:12:55 EDT 2023 x86_64
Shell: /bin/bash
PHP binary: /opt/cpanel/ea-php82/root/usr/bin/php.cagefs
PHP version: 8.2.7
php.ini used: /opt/cpanel/ea-php82/root/etc/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 8.0.33 for Linux on x86_64 (MySQL Community Server – GPL)
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /home/mickry
WP-CLI packages dir:
WP-CLI cache dir: /home/mickry/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.8.1

Damian Koćwin

Leave a Reply