Want more timely Centmin Mod News Updates?
Become a Member

wpcli.sh addon discussion

Discussion in 'Add Ons' started by eva2000, Apr 10, 2015.

  1. eva2000

    eva2000 Administrator Staff Member

    30,146
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    9:14 PM
    Nginx 1.13.x
    MariaDB 5.5
    Discussion thread for official Centmin Mod wpcli.sh Addon.

    Full working WP-CLI usage guide added here.

    Centmin Mod v1.2.3 beta adds support for Wordpress WP-CLI tool which allows you to manage Wordpress installations from command line - including updating plugins, multisite wordpress installs and creating post etc. The addon can be found in zip download folder /addons/wpcli.sh.

    You'll need to give wpcli.sh executable permissions before running the script.

    Note: If you're using older Centmin Mod version prior to using latest Centmin Mod v1.2.3 beta (13/06/13 dated), you will need to first run centmin.sh menu option #5 to recompile PHP so you have readline and PCNTL PHP extension support first before running wpcli.sh.
    Code:
    cd /usr/local/src/centmin-v1.2.3mod/addons/
    chmod +x wpcli.sh
    ./wpcli.sh install
    
    Then log out of SSH telnet session, then log back in so below commands work properly. This only has to be done the initial time after install only.

    WP-CLI requires installation of git on your CentOS server and the Centmin Mod Addon script installer will take care of all dependency requirements including the required PHP readline and PCNTL extension support.
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,146
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    9:14 PM
    Nginx 1.13.x
    MariaDB 5.5
    WP-CLI version 0.14 was released with changes to prevent the tool from being run as root user. When you run WP-CLI command as root user you will get the below warning and suggestions on 2 ways to now run the tool. For now with Centmin Mod, you would need to use --allow-root flag. At least until future Centmin Mod versions support proper chrooted and jailed individual user accounts (see preview of this feature here).

    Running command:
    Code:
    wp --info
    
    will now result in warning below
    Code:
    Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress install exists under.
    
    If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS.
    
    If you'd like to continue as root, please run this again, adding this flag: --allow-root
    
    If you'd like to run it as the user that this site is under, you can run the following to become the respective user:
    
    sudo -u USER -i -- wp ...
    
    To run command now with 0.14, you need to run as:
    Code:
    wp --info --allow-root
    
    output:
    Code:
    PHP binary: /usr/local/bin/php
    PHP version: 5.5.8
    php.ini used: /usr/local/lib/php.ini
    WP-CLI root dir: phar://wp-cli.phar
    WP-CLI global config:
    WP-CLI project config:
    WP-CLI version: 0.14.0