Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    wp-cli not working on 6.3.5?

    WordPress (Developer)
    2
    13
    474
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • martinkbs
      martinkbs last edited by

      wp-cli not working on 6.3.5?

      Hi guys,

      After updating two Cloudrons I find the same problem in the WordPress (managed) installations.

      Connecting...
      If you resize the browser window, press Ctrl+D to start a new session with the current size.
      root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/code# wp plugin list
      bash: wp: command not found
      root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/code# 
      

      Anyone has encountered the same error?

      Thanks!

      girish 1 Reply Last reply Reply Quote 0
      • girish
        girish Staff @martinkbs last edited by

        @martinkbs I think same as https://forum.cloudron.io/topic/5382/wp-cli-disappeared . Can you try giving the full path?

        martinkbs 1 Reply Last reply Reply Quote 0
        • martinkbs
          martinkbs @girish last edited by

          @girish

          Reconnecting...
          If you resize the browser window, press Ctrl+D to start a new session with the current size.
          root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/code# cd /app/pkg/wp
          bash: cd: /app/pkg/wp: Not a directory
          root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/code# cd /app/pkg/  
          root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/pkg# ls         
          authLdap.zip  credentials.template  cron.sh  mpm_prefork.conf  smtp-mailer.zip  start.sh  wp  wp-convert-multisite  wp-redis-cache.zip
          root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/pkg# wp plugin list
          bash: wp: command not found
          root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/pkg# 
          
          girish 2 Replies Last reply Reply Quote 0
          • girish
            girish Staff @martinkbs last edited by

            @martinkbs you have to either do /app/pkg/wp plugin list OR if you cd /app/pkg, then ./wp plugin list (the dot slash in the front is important).

            martinkbs 1 Reply Last reply Reply Quote 0
            • girish
              girish Staff @martinkbs last edited by

              @martinkbs Is this managed wordpress or the developer wordpress ? The CLI command is slightly different depending on which one.

              1 Reply Last reply Reply Quote 0
              • martinkbs
                martinkbs @girish last edited by

                @girish

                With /app/pkg/wp plugin list

                Imagen PNG 5.png

                With cd /app/pkg, then ./wp plugin list

                Imagen PNG 6.png

                The installation is always WordPress (Developer)

                girish 1 Reply Last reply Reply Quote 0
                • girish
                  girish Staff @martinkbs last edited by

                  @martinkbs you have to use the command like in https://docs.cloudron.io/apps/wordpress-developer/#wp-cli . So,

                  sudo -E -u www-data php /app/pkg/wp --path=/app/data/public/ plugin list
                  

                  To explain the arguments:

                  • sudo is for running the command as a different user. -u www-data means run it as www-data user (which is what apache is running as)
                  • -E means to preserve environment variables. This way the container's env vars are passed on to the CLI command as well.
                  • --path is required to specify the path to the installation of WP.
                  martinkbs 1 Reply Last reply Reply Quote 0
                  • martinkbs
                    martinkbs @girish last edited by

                    Hi @girish

                    WP-cli commands, up to version 6.3.X update have always worked the same way. In fact, I have several Cloudrons in version 6.2.8, in which the 'wp plugin list' command works as WP-cli has to.

                    According to your explanation, it means that from now on, in version 6.3.X you have to put the command as you mentioned?

                    sudo -E -u www-data php /app/pkg/wp --path=/app/data/public/ plugin list
                    

                    Or is it going to restore the original format that was used until now? As you will see, it is not a very productive way to work with the terminal.

                    girish 1 Reply Last reply Reply Quote 0
                    • girish
                      girish Staff @martinkbs last edited by girish

                      @martinkbs you are right, there should be a wp command alias. I see that it's in the package code as well. Let me see why it broke.

                      1 Reply Last reply Reply Quote 0
                      • girish
                        girish Staff last edited by

                        It seems /root/.bashrc is not sourced for some reason. If you do, source /root/.bashrc , then wp starts to work. Investigating further.

                        1 Reply Last reply Reply Quote 0
                        • girish
                          girish Staff last edited by girish

                          I had made a change that source any app specific rcfile for 6.3. I did this for https://forum.cloudron.io/topic/4992/seting-bash-aliases-for-cloudron-terminal. Unfortunately, this breaks sourcing of the personal rcfile. From the man page,

                                 --rcfile file
                                        Execute commands from file instead of the system wide initialization file /etc/bash.bashrc and the standard personal initialization file ~/.bashrc if the shell is interac‐
                                        tive (see INVOCATION below).
                          

                          @martinkbs I will look into how to fix this now that I know what the issue is. Thanks for reporting! For the moment, the workaround is to type source /root/.bashrc after you open a web terminal and then the wp command should work.

                          martinkbs 1 Reply Last reply Reply Quote 0
                          • martinkbs
                            martinkbs @girish last edited by

                            Thanks @girish

                            Checked. After starting the terminal, inserting the commandsource /root/.bashrc, WP-cli works normally.

                            Connecting...
                            If you resize the browser window, press Ctrl+D to start a new session with the current size.
                            root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/code# source /root/.bashrc
                            root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/code# wp core version
                            5.8
                            root@2d2d8096-2889-44f0-b36b-0aed411943c6:/app/code# 
                            

                            At least, even temporarily, it solves the problem and lets you use the terminal.

                            If you need help, please let me know to make checks.

                            Thanks again!

                            1 Reply Last reply Reply Quote 0
                            • girish
                              girish Staff last edited by

                              I have fixed this for the next release.

                              1 Reply Last reply Reply Quote 1
                              • First post
                                Last post
                              Powered by NodeBB