New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match WP-CLI version to support PHP 5.3 #1334

Closed
Idealien opened this Issue Dec 19, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@Idealien
Copy link

Idealien commented Dec 19, 2018

Bug Report

Tell us about your setup

v3.0.0-rc.1 on Linux Mint 18.3

Tell us about your .lando.yml

name: eligibility
recipe: wordpress
proxy:
  mailhog:
    - mailhog.eligibility.lndo.site
config:
  php: '5.3'
  via: nginx
  webroot: web

services:
  mailhog:
    type: mailhog
    hogfrom:
      - appserver
      - nginx

tooling:

  php:
    service: appserver
    
  mysql:
    user: root
    service: database

Tell us about the command you were running

lando start

Tell us about the error you got

Attempting to setup a PHP 5.3 based WordPress environment in order to prep/test an upgrade to PHP 7.1+ The site setup completes, but wp-cli install reports warning and does not respond to subsequent 'lando wp' commands. Start error log shows the following:

verbose: /usr/share/lando/bin/docker-compose,--project-name,eligibility,--file,/home/idealien/.lando/compose/eligibility/eligibility-2.yml,--file,/home/idealien/.lando/proxy/eligibility-proxy-3.yml,up,-d,--no-recreate,--remove-orphans,appserver finished with code 0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5294k  100 5294k    0     0  1927k      0  0:00:02  0:00:02 --:--:-- 1926k
PHP Parse error:  syntax error, unexpected '[' in phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeFrameworkAutoloader.php on line 34
PHP Stack trace:
PHP   1. {main}() /tmp/wp-cli.phar:0
PHP   2. include() /tmp/wp-cli.phar:4
PHP   3. include() phar:///tmp/wp-cli.phar/php/boot-phar.php:11
PHP   4. WP_CLI\bootstrap() phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php:25
PHP   5. WP_CLI\Autoloader->autoload() phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php:73

Parse error: syntax error, unexpected '[' in phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeFrameworkAutoloader.php on line 34

Call Stack:
    0.0190    1137080   1. {main}() /tmp/wp-cli.phar:0
    0.0191    1135824   2. include('phar:///tmp/wp-cli.phar/php/boot-phar.php') /tmp/wp-cli.phar:4
    0.0192    1155408   3. include('phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php') phar:///tmp/wp-cli.phar/php/boot-phar.php:11
    0.0194    1178608   4. WP_CLI\bootstrap() phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php:25
    0.0229    2229048   5. WP_CLI\Autoloader->autoload() phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php:73

error: Looks like one of your build steps failed with [object Object]
warn: This **MAY** prevent your app from working
warn: Check for errors above, fix them, and try again

Tell us generally about your bug

WP-CLI v2.0+ has a minimum required PHP version to 5.4.
The last WP-CLI to support 5.3.X is 1.5.1
Recommend PHP version check to associate which version of WP-CLI to install.

Tell us more

Workaround does exist to:

  1. lando ssh
  2. Follow WP-CLI install instructions with 1.5.1 version

Feature Request

As a lando user who works with converting legacy PHP/WordPress sites that use PHP 5.3, I want the option to specify WP-CLI version as a part of the lando config process OR that it automatically detects the appropriate version based on PHP version specified.

Lando can help solve this problem by:

  • Adding WP-CLI version option to the WordPress recipe
  • Detecting PHP version / WP-CLI requirements if WP-CLI version not specified but PHP version is
@Idealien

This comment has been minimized.

Copy link
Author

Idealien commented Dec 19, 2018

Workaround
The following addition to the .lando.yml file would copy a local copy of wpcli 1.5.1 (from /lando/wpcli/ app folder) in during the setup process.

events:
  pre-start:
    - chmod u+x /app/lando/wpcli/wp-cli-1.5.1.phar
    - cp /app/lando/wpcli/wp-cli-1.5.1.phar /usr/local/bin/wp

Code Exploration
From https://github.com/lando/lando/blob/85dc5ff0bb550842d88e85fd2b06970ac72f31ec/plugins/lando-recipes/recipes/wordpress/wordpress.js - it looks like a WPCLI version config to pass into wpCliUrl function to let .lando.yml based definition.

@pirog pirog added this to the 3.0.0-rc.2 milestone Jan 28, 2019

@pirog pirog self-assigned this Jan 28, 2019

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 29, 2019

@Idealien this is not going to be a supported or documented feature but if you use php 5.3 with the wordpress recipe it will install wp-cli 1.5.1 instead of the latest.

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 29, 2019

looks like even that version doesnt work with the latest WP version
PHP Parse error: syntax error, unexpected '[' in phar:///tmp/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/IncludeFrameworkAutoloader.php on line 34

pirog added a commit that referenced this issue Jan 29, 2019

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 29, 2019

OK this will be in RC2 but will be unsupported so YMMV

@pirog pirog closed this Jan 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment