几个月前,我尝试卸载drush 6,以便将drush 8改为drush 8(用于D6到D8迁移)。我完全不知道为什么,但不可能在我的网站上安装drush 8,无论使用什么方法(直接或通过composer)。
更确切地说,乍一看,drush 8.1似乎已经正确安装,但是一个"drush状态“命令奇怪地显示了”版本8.0.3安装“,并且在尝试在drupal目录中使用drush 8时没有认出drupal站点。
我准确地说,我是托管的VPS上安装了PHP5.5,而drush 6.7运行得非常好。
下面是在我尝试使用composer时使用的详细信息(自那以后没有改进):
[~]# 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]发布于 2016-09-10 15:19:29
嗯,我想我终于找到了问题的根源。
我以前的drush status错误地显示:
[~]# 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之后,我删除了/home/user/vendor/drush目录和其他剩余的Drush文件和目录,以便从尽可能干净的情况下重新启动。然后,我用composer重新安装了Drush 8,现在drush status正确地显示:
[~]# 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奇怪的是,这只是对Drush 8的一个问题,而不是对于Drush 6的问题,但最终Drush 8似乎暂时运行良好。
发布于 2016-09-10 12:55:10
这种方法应该可以在几乎所有的环境中工作:
浏览https://github.com/drush-ops/drush/releases以获得您想要的版本。您不能在php5.5中使用drush 9,所以必须选择drush 8。
下载选定的drush版本
wget https://github.com/drush-ops/drush/releases/download/8.1.3/drush.phar并尝试运行这个php运行时文件:
/usr/local/php5.5/bin/php drush.phar statusphp路径就是一个例子。如果php没有获得正确的php版本,您只需要它。
您可以像这样继续运行drush,但是将其重命名为drush、使用chmod +x drush使其可执行并将其复制到您的shell将其作为可执行文件找到的位置(在$PATH中定义的路径)更为方便。这取决于您的环境允许您执行phar文件。
https://drupal.stackexchange.com/questions/214356
复制相似问题