Skip to content

Access WP-CLI via SSH

1. SSH into your server

SSH into your server to access the wpcontroller command line interface (CLI).

2. Find your site ID

Your site must be started to access the WP-CLI shell.

$ sudo wpcontroller site list

SITE ID                    DOMAIN                CURRENT STATE    TARGET STATE     TASK             CREATED             
-------------------------  --------------------  ---------------  ---------------  ---------------  --------------------
site_cd9el81hvg0edvd88arg  example.com           Started          Started          None             21 Oct 22 18:53 UTC 

3. Launch the PHP shell

$ sudo wpcontroller site shell site_cd9el81hvg0edvd88arg php

4. Run WP-CLI commands

The complete list of WP-CLI commands is available on the WordPress developer site.

www-data@php:/wordpress$ wp cli info
OS: Linux 5.4.0-121-generic #137-Ubuntu SMP Wed Jun 15 13:33:07 UTC 2022 x86_64
Shell:  
PHP binary: /usr/local/bin/php
PHP version:    8.0.24
php.ini used:   
MySQL binary:   /usr/bin/mysql
MySQL version:  mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
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:   /wordpress
WP-CLI packages dir:    
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.6.0