Skip to content
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

PHP Shell (php:cli) doesn't seem to work #3595

Closed
hansfn opened this issue Jun 28, 2018 · 6 comments
Closed

PHP Shell (php:cli) doesn't seem to work #3595

hansfn opened this issue Jun 28, 2018 · 6 comments

Comments

@hansfn
Copy link
Contributor

hansfn commented Jun 28, 2018

I am using Drush 9.3.0 amd I'm unable to use "php:cli".

Running drush status works as it should. Opening a Drupal PHP shell using drush php:cli (in the same directory) and calling status fails - see below. I tested drush core-cli with Drush 8.1.16 on a Drupal 7 site and it work as expected. Do we have a regression?

$ drush php:cli
Psy Shell v0.9.6 (PHP 7.1.18 — cli) by Justin Hileman
>>> status

  The "--fields" option does not exist.                                     

help [--format [FORMAT]] [--include-field-labels] [--table-style [TABLE-STYLE]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--] <command> [<command_name>]

 [warning] Invalid argument supplied for foreach() DrushCommand.php:90

>>> exit
Exit:  Goodbye
@weitzman
Copy link
Member

yes, i see that too. ping @damiankloip

@damiankloip
Copy link
Contributor

Yes, I think a lot of stuff changed in the last few months with drush internals etc... I can take a look at this tomorrow, see what's going down.

@havran
Copy link

havran commented Aug 13, 2018

In my local vagrant machine (Ubuntu) command drush php stuck - i get no prompt >>>. drush -vvv verbose output is attached.

vagrant@d8:/data/uniweb/drupal8$ uname -a
Linux d8 4.4.0-131-generic #157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
vagrant@d8:/data/uniweb/drupal8$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:        16.04
Codename:       xenial
vagrant@d8:/data/uniweb/drupal8$ drush @nz php
Psy Shell v0.9.7 (PHP 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
^C
vagrant@d8:/data/uniweb/drupal8$ drush @nz php -vvv
 [preflight] Redispatch to site-local Drush: /data/uniweb/drupal8/vendor/drush/drush/drush.
 [preflight] Config paths: /data/uniweb/drupal8/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /data/uniweb/drupal8/web/drush/sites,/data/uniweb/drupal8/drush/sites
 [preflight] Commandfile search paths: /data/uniweb/drupal8/vendor/drush/drush/src
 [debug] Bootstrap further to find php:cli
 [debug] Trying to bootstrap as far as we can
 [bootstrap] Drush bootstrap phase: bootstrapDrupalRoot()
 [bootstrap] Change working directory to /data/uniweb/drupal8/web
 [bootstrap] Initialized Drupal 8.5.6 root directory at /data/uniweb/drupal8/web
 [bootstrap] Drush bootstrap phase: bootstrapDrupalSite()
 [bootstrap] Initialized Drupal site cms.ferratum.co.nz.local at sites/cms.ferratum.co.nz
 [bootstrap] Drush bootstrap phase: bootstrapDrupalConfiguration()
 [debug] Add service modifier
 [info] sql-query: SELECT 1;
 [info] Executing: mysql --defaults-file=/tmp/drush_YVwyFx --database=d8_ferratum_co_nz_local --host=localhost --port=3306 --silent  < /tmp/drush_oLbsgE
  1
 [info] sql-query: SELECT 1 FROM key_value LIMIT 1;
 [info] Executing: mysql --defaults-file=/tmp/drush_2FXgwk --database=d8_ferratum_co_nz_local --host=localhost --port=3306 --silent  < /tmp/drush_6OpT5q
  1
 [bootstrap] Drush bootstrap phase: bootstrapDrupalDatabase()
 [bootstrap] Successfully connected to the Drupal database.
 [bootstrap] Drush bootstrap phase: bootstrapDrupalFull()
 [debug] Start bootstrap of the Drupal Kernel.
 [debug] Finished bootstrap of the Drupal Kernel.
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigExportCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigImportCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\BatchCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\CliCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\DrupalCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\EntityCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\ImageCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\LanguageCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\LocaleCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\MessengerCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\QueueCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\RoleCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\StateCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\TwigCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\UserCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\ViewsCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\WatchdogCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\pm\PmCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\pm\ThemeCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommentsCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeSessionsCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserFieldsCommands
 [debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands
 [debugnotify] Add a commandfile class: Drupal\s3fs\Commands\S3fsCommands
 [debugnotify] Add a commandfile class: Drupal\webform\Commands\WebformCommands
 [debug] Done with bootstrap max in Application::find(): trying to find php:cli again.
 [bootstrap] Starting bootstrap to none [0.26 sec, 23.31 MB]
 [bootstrap] Drush bootstrap phase 0 [0.26 sec, 23.31 MB]
 [bootstrap] Try to validate bootstrap phase 0 [0.26 sec, 23.31 MB]
 [info] History: /home/vagrant/.drush/cache/cli/drupal-site-nz.dev [0.26 sec, 23.55 MB]
Psy Shell v0.9.7 (PHP 7.2.8-1+ubuntu16.04.1+deb.sury.org+1 — cli) by Justin Hileman
<--- stuck here
vagrant@d8:/data/uniweb/drupal8$ drush -v
Drush Commandline Tool 9.4-dev-ge30df96a

damiankloip added a commit to damiankloip/drush that referenced this issue Aug 28, 2018
damiankloip added a commit to damiankloip/drush that referenced this issue Aug 28, 2018
@fgm
Copy link
Contributor

fgm commented Apr 8, 2019

Same problem today with core 8.6.14 and Drush 9.6.2.

@greg-1-anderson
Copy link
Member

Maybe this is related to Drush getting the wrong answer when it tried to determine whether it should use a tty or not. See #4033 which uses a better method for checking the tty. That technique might be helpful here.

@fgm
Copy link
Contributor

fgm commented Apr 10, 2019

Thanks @greg-1-anderson . @weitzman noticed the command was redispatched using the absolute path when using that local ùdrush found in $PATH (which starts by ./vendor/bin). Launching by an explicit ./vendor/bin/drush instead of depending on the path fixed the redispatching, and this issue, weird as it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants