lando / wordpress

The Official WordPress Lando Plugin
https://docs.lando.dev/wordpress/
GNU General Public License v3.0
14 stars 7 forks source link

WP CLI not installed in container (/bin/sh: 1: wp: not found wp: not found) #15

Open clacdesdoigts opened 2 years ago

clacdesdoigts commented 2 years ago

WP CLI is not being installed in the default "appserver" service Thus, typing lando wp returns /bin/sh: 1: wp: not found

Might be related to #3395

My lando.yml :

name: wordpress
recipe: wordpress
proxy:
  appserver:
    - wordpress.lndo.site
    - espace.wordpress.lndo.site
    - account.wordpress.lndo.site
    - ca.wordpress.lndo.site
config:
  php: "7.3"
  via: apache
  webroot: web
  database: mysql:5.7
  xdebug: true
# Services
services:
  database_admin:
    type: phpmyadmin:5.0
    hosts:
      - database
  mail:
    type: mailhog:v1.0.0
    portforward: true
    hogfrom:
      - appserver

Commands are launched in WSL2 (core version : 5.10.16) on Windows 11, in a Debian 11 (bullseye) distribution. Lando version : 3.6.5

matpratta commented 2 years ago

@clacdesdoigts try running lando rebuild, I had this issue with another recipe and it fixed the issue

alex-r-redfern commented 2 years ago

I think this may be related to https://github.com/lando/wordpress/blob/main/recipes/wordpress/builder.js only installing the CLI if the PHP version is 7.4. I'm seeing the same issue when running Lando in 8.0 and it looks like the above is using 7.3

alex-r-redfern commented 2 years ago

Yep, just confirmed: switching my lando yml to use 7.4 installs the cli but 8.0 does not

alex-r-redfern commented 2 years ago

As a stop-gap for anyone else experiencing this whilst this bug still happens, add this to your lando config:

services:
  appserver:
    build_as_root:
      - curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
      - chmod +x wp-cli.phar
      - mv wp-cli.phar /usr/local/bin/wp

and down at the bottom:

tooling:
  wp:
    service: 'appserver'

This makes lando wp work as expected