1

Few months ago I've tried to uninstall drush 6 in order to put drush 8 instead (for D6 to D8 migration purposes). I absolutely don't know why, but it's been impossible to install drush 8 on my site, whatever the method used (either directly or via composer).

More precisely, at first glance it seemed that drush 8.1 had been properly installed, but a "drush status" command displayed curiously "version 8.0.3 installed", and no drupal site has been recognised when trying to use drush 8 in the drupal directories.

I precise that I'm hosted on a managed VPS with PHP 5.5 installed and that drush 6.7 worked perfectly well.

Here are the details while using composer at the time I tried to do it (no improvement since):

[~]# composer global require drush/drush:8.*

Changed current directory to /home/user/.composer

./composer.json has been created

Loading composer repositories with package information

Updating dependencies (including require-dev)

  - Installing pear/console_table (v1.3.0)
    Downloading: 100%         

  - Installing symfony/polyfill-mbstring (v1.2.0)
    Downloading: 100%         

  - Installing symfony/console (v2.8.6)
    Downloading: 100%         

  - Installing symfony/var-dumper (v2.8.6)
    Downloading: 100%         

  - Installing symfony/yaml (v2.8.6)
    Downloading: 100%         

  - Installing jakub-onderka/php-console-color (0.1)
    Downloading: 100%         

  - Installing jakub-onderka/php-console-highlighter (v0.3.2)
    Downloading: 100%         

  - Installing dnoegel/php-xdg-base-dir (0.1)
    Downloading: 100%         

  - Installing nikic/php-parser (v2.1.0)
    Downloading: 100%         

  - Installing psy/psysh (v0.7.2)
    Downloading: 100%         

  - Installing psr/log (1.0.0)
    Downloading: 100%         

  - Installing drush/drush (8.1.2)
    Downloading: 100%         

pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)

symfony/console suggests installing symfony/event-dispatcher ()

symfony/console suggests installing symfony/process ()

symfony/var-dumper suggests installing ext-symfony_debug ()

psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))

psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)

psy/psysh suggests installing ext-readline (Enables support for arrow-key history navigation, and showing and manipulating command history.)

psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)

drush/drush suggests installing ext-pcntl (*)

drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)

Writing lock file

Generating autoload files

[~]# drush status

 PHP executable         :  /usr/bin/php-cli

 PHP configuration      :  /usr/local/lib/php.ini

 PHP OS                 :  Linux

 Drush script           :  /home/user/vendor/drush/drush/drush.php

 Drush version          :  8.0.3

 Drush temp directory   :  /tmp

 Drush configuration    :

 Drush alias files      :

 /home/user/.drush/en.aliases.drushrc.php

 /home/user/.drush/fr.aliases.drushrc.php

 /home/user/.drush/es.aliases.drushrc.php

[~]# drush version

 Drush Version   :  8.0.3

[~]# cd public_html/en/sites/en.mysite.com/

[~/public_html/en/sites/en.mysite.com]# drush cc all

No Drupal site found, only 'drush' cache was cleared.                [warning]

[~/public_html/en/sites/en.mysite.com]# drush ups

Command pm-updatestatus needs a higher bootstrap level to run - you  [error]
will need to invoke drush from a more functional Drupal environment
to run this command.

The drush command 'ups' could not be executed.                       [error]
4
  • Here is the (alternative) composer install docs, but you don't need to use composer to install Drush if you use the (regular) install method
    – No Sssweat
    Sep 9, 2016 at 22:17
  • That's exactly what I've already done. I first followed the "Install/Upgrade a global Drush" method, then the "Install a global Drush via Composer" one, both carefully. While I had and have still no problem at all with both methods to install and use Drush 6, it appears to be impossible for me to do so with Drush 8.
    – Roger-Ro
    Sep 9, 2016 at 22:28
  • you only need to use 1 method. What happened when you tried the Install/Upgrade a global Drush method? In your Q you have the composer method.
    – No Sssweat
    Sep 9, 2016 at 22:37
  • After having removed Drush 6, I firstly tried the "Install/Upgrade a global Drush" method, which failed with Drush 8. I've therefore removed all the changes made before trying the "Install a global Drush via Composer" one instead, which also failed with Drush 8. Both methods displays the same results when trying to launch "drush status", "drush version", "drush cc all", "drush ups",... with Drush 8. The reason why I put the composer method in my Q is because it's the last one I tried to use. But none works for me.
    – Roger-Ro
    Sep 9, 2016 at 22:50

2 Answers 2

1

This method should work in almost all environments:

Browse https://github.com/drush-ops/drush/releases for the release you want. You can't use drush 9 with php 5.5, so you have to choose drush 8.

Download the selected drush version

wget https://github.com/drush-ops/drush/releases/download/8.1.3/drush.phar

and try to run this php runtime file:

/usr/local/php5.5/bin/php drush.phar status

The php path is an example. You only need it, if php does not pickup the right php version.

You can keep running drush like this, but it is more convenient to rename it to drush, make it executable with chmod +x drush and copy it to a location where your shell finds it as executable (a path defined in $PATH). This depends on that your environment allows you to execute phar files.

0
0

Well, I think I've found where the problem came from at last.

My previous drush status displayed erroneously:

[~]# drush status
 PHP executable         :  /usr/bin/php-cli
 PHP configuration      :  /usr/local/lib/php.ini
 PHP OS                 :  Linux
 Drush script           :  /home/user/vendor/drush/drush/drush.php
 Drush version          :  8.0.3

After having uninstalled Drush, I've removed the /home/user/vendor/drush directory and other remaining Drush files and directories in order to restart from the cleanest possible situation. I've then reinstalled Drush 8 with composer, and now the drush status displays rightly:

[~]# drush status
 PHP executable         :  /usr/bin/php-cli
 PHP configuration      :  /usr/local/lib/php.ini
 PHP OS                 :  Linux
 Drush script           :  /home/user/.composer/vendor/drush/drush/drush.php
 Drush version          :  8.1.3

The curious thing is that this was a problem for Drush 8 only, not for Drush 6. But finally Drush 8 seems to work well for the moment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.