How to integrate WP-CLI in Plesk?

Follow

Comments

19 comments

  • Avatar
    Maghreb Services SARL

    The link to the documentation is broken, maybe it should be this:

    https://docs.plesk.com/en-US/onyx/cli-linux/using-command-line-utilities/wptoolkit-wordpress-toolkit.78685/ 

    0
    Comment actions Permalink
  • Avatar
    Sharul Hafiz

    HI Ivan, your 'here' link is broken.

    0
    Comment actions Permalink
  • Avatar
    Albert Jan Grasmeijer (Edited )

    Hi, I'm trying to get this plugin Index WP MySQL For Speed to work with the WP-CLI.

    The description (somewhere on the bottom) recommends using WP-CLI as this will not result in timeouts during execution, which seemed perfect. But this has failed so far.

    What I did so far with success:

    plesk ext wp-toolkit --wp-cli -instance-id 1 -- index-wp-mysql-for-speed --activate


    The command that fails to work however is the following one (instructions also in the plugin description in the URL given above):

    plesk ext wp-toolkit --wp-cli -instance-id 1 -- index-mysql

    OR (I tried using the full plugin name as well)

    plesk ext wp-toolkit --wp-cli -instance-id 1 -- index-wp-mysql-for-speed

     

    Both these commands result in the same error:

    Error: 'index-wp-mysql-for-speed' is not a registered wp command. See 'wp help' for available commands.


    Why is this? Am I missing something? Does WP-CLI (provided by WP-Toolkit) not support using plugin commands?

    0
    Comment actions Permalink
  • Avatar
    Daniel Pereyra

    Helo, is there a way to use wp-cli without installing the WordPress Toolkit Ext?

    Thank you.

    0
    Comment actions Permalink
  • Avatar
    Yaroslav Tarasov

    Hello @Daniel Pereyra,

    You can install wp-cli directly o the server as described in the official WordPress documentation: https://make.wordpress.org/cli/handbook/

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov (Edited )

    Hello Project Aspen,

    > not working for me... tried even to install wp-cli.phar

    Was there any error displayed?

    Have you used commands like described here to install wp-cli.phar?

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Maghreb Services SARL
    Thank you for noticing! I have changed the link accordingly.

    0
    Comment actions Permalink
  • Avatar
    Phi Nguyen

    Hi Support Plesk,

    I want to know if Plesk + WP-CLI is working well?

    Can Plesk + WP-CLI + SSH be used by customers?

    If the customers with SSH rights executes the WP-CLI command, will it affect security, is the data of other customers on the same server separate from each other?

    0
    Comment actions Permalink
  • Avatar
    Taras Ermoshin

    Hello @Michael Klaumann!

    As per the above comment, WP-CLI shipped with WP Toolkit may not work with plugins' commands.

    As WP-CLI shipped with WP Toolkit is called via the command plesk ext wp-toolkit, it can be used only under the 'root' user (as the plesk utility is available only under the 'root' user).

    0
    Comment actions Permalink
  • Avatar
    Michael Klaumann

    Just checking on this?

     

    0
    Comment actions Permalink
  • Avatar
    Taras Ermoshin

    Hello @Albert Jan Grasmeijer!

    As I know, plugins add their commands to WP-CLI, so they should be aware of the location of the WP-CLI to do this.

    WP-CLI provided by the WP Toolkit is stored in the custom location, so it's most likely the reason for why the plugin commands don't work.

    So, you can try using WP-CLI that's manually installed to the website's directory and see whether the plugin commands will work in such case, or contact the plugin developers to know more how to add their plugin's commands to WP-CLI.

    0
    Comment actions Permalink
  • Avatar
    Michael Klaumann

    Thanks @Taras Ermosin,

    My main purpose is to allow users to have access to the WP-CLI so having it only available to the 'root' user is very limiting.  Is there a way to make it available to users in a chrooted shell? Seems simple enough.  All the major web hosting companies have the WP-CLI available to every user so this is a selling point.

    If I install the regular non-Plesk version of WP-CLI can I make that available to the users?  More of a Linux question at this point. 

    0
    Comment actions Permalink
  • Avatar
    Taras Ermoshin

    Hi @Michael Klaumann!

    The plesk utility cannot be added to the chrooted shell.

    You can install regular WP-CLI directly to users' chrooted shells manually.

    0
    Comment actions Permalink
  • Avatar
    Michael Klaumann (Edited )

    Is it the case with Plesk version 18.0.48 that the Plesk WP-CLI does not have all the features of the full WP-CLI?  And that only the root user can use it?

    I want to install it so users can have access to the WP-CLI from their individual accounts.

     

    0
    Comment actions Permalink
  • Avatar
    George Georgopoulos

    For some reason, WP CLI import command [https://developer.wordpress.org/cli/commands/import/] does not work. It is giving the error WordPress Importer needs to be activated. Try 'wp plugin activate wordpress-importer'.

    Is this a feature that hasn't been implemented?

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hello @George Georgopoulos,

    The "plesk ext wp-toolkit --wp-cli" utility is not a full replacement of native "wp" utility

    It has limited functionality and "import" is not supported Plesk "wp-cli" command

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Thank you @Sharul, it's fixed.

    0
    Comment actions Permalink
  • Avatar
    Project Aspen (Edited )

    Nikita Marinchuk 

     

    Hi, I'm trying to regenerate media and I thought the command media was available in WP-CLI...

     

    plesk ext wp-toolkit --wp-cli -instance-id 2 -path /var/www/vhosts/xxx/httpdocs -- media regenerate --yes

     

    not working for me... tried even to install wp-cli.phar

     

    I really need to regenerate thumbnails, if command is not available how do I go about making a complete WP-CLI installation on Plesk? I also would like to use Smush, Media Cleaner and others with WP-CLI...

     

    thanks

    0
    Comment actions Permalink
  • Avatar
    Bulat Tsydenov

    @Phi Nguyen

    Hi,

    I can see that you got an answer to your question in a support ticket.

    Anyway, let me answer it here for others: WP-CLI utility can be run only by administrator of the server, in other words by root user.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request