Drush无法识别Drupal(找不到Drupal网站) [英] Drush can't recognize Drupal (No Drupal site found)

查看:960
本文介绍了Drush无法识别Drupal(找不到Drupal网站)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了 http://docs.drush.org/en/master的说明/ install / 安装Drush(尝试全局和个人选项)

I have followed instructions on http://docs.drush.org/en/master/install/ to install Drush (tried both global and individual options).

当我到Drupal站点根目录并输入drush status时,我得到以下:

When I cd to the Drupal site root and type "drush status" I get the following:

 Drupal version         :  7.34
 Site URI               :  http://default
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /etc/php.ini
 PHP OS                 :  Linux
 Drush script           :  /root/.composer/vendor/drush/drush/drush.php
 Drush version          :  7.0.0
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /var/www/site_dev
 Site path              :  sites/default

当我输入drush cc all我得到:

When I type "drush cc all" I get:

No Drupal site found, only 'drush' cache was cleared.
'all' cache was cleared.    

当我输入drush sqlc我得到:

When I type "drush sqlc" I get:

exception 'ReflectionException' with message 'Class Drush\Sql\Sql7 does not have a constructor, so you cannot pass any constructor      [error]
arguments' in /root/.composer/vendor/drush/drush/includes/drush.inc:113
Stack trace:
#0 /root/.composer/vendor/drush/drush/includes/drush.inc(113): ReflectionClass->newInstanceArgs(Array)
#1 /root/.composer/vendor/drush/drush/commands/sql/sql.drush.inc(605): drush_get_class('Drush\Sql\Sql', Array, Array)
#2 /root/.composer/vendor/drush/drush/commands/sql/sql.drush.inc(588): drush_sql_get_version()
#3 /root/.composer/vendor/drush/drush/commands/sql/sql.drush.inc(454): drush_sql_get_class()
#4 [internal function]: drush_sql_cli()
#5 /root/.composer/vendor/drush/drush/includes/command.inc(368): call_user_func_array('drush_sql_cli', Array)
#6 /root/.composer/vendor/drush/drush/includes/command.inc(219): _drush_invoke_hooks(Array, Array)
#7 [internal function]: drush_command()
#8 /root/.composer/vendor/drush/drush/includes/command.inc(187): call_user_func_array('drush_command', Array)
#9 /root/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#10 /root/.composer/vendor/drush/drush/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#11 /root/.composer/vendor/drush/drush/drush.php(11): drush_main()
#12 {main}

它使我觉得这个问题与MySQL有关系(因为状态不列出DB参数),但是我无法理解。

It strikes me that the problem has something to do with MySQL (because the status doesn't list the DB parameters), but I can't figure it out. Under sites there is only default folder, so it's not a multisite installation.

任何人都可以建议您有什么问题吗?

Can anyone advise what's wrong please?

更新
我已将PHP升级到5.5.27并重新安装Drush 7.0.0。
遵循一个建议这里我从主文件夹中删除了my.cnf,之后drush sqlc开始工作,但是当我输入drush -v -d status时,它给了我:

UPDATE I have upgraded PHP to 5.5.27 and reinstalled Drush 7.0.0. Following an advice here I deleted my.cnf from the home folder and after that "drush sqlc" started to work, however when I type "drush -v -d status" it gives me:

Starting Drush preflight. [0.01 sec, 2.08 MB]                                                                                           [preflight]
Cache HIT cid: 7.0.0-commandfiles-0-81cc86c1995ab7206f383ec28ad43baf [0.01 sec, 2.14 MB]                                                    [debug]
Bootstrap to phase 0. [0.07 sec, 6.08 MB]                                                                                               [bootstrap]
Drush bootstrap phase : bootstrap_drupal_root() [0.08 sec, 6.43 MB]                                                                     [bootstrap]
Initialized Drupal 7.34 root directory at /var/www/site_dev [0.08 sec, 6.43 MB]                                                           [notice]
Find command files for phase 1 (max=7) [0.08 sec, 4.48 MB]                                                                                  [debug]
Cache HIT cid: 7.0.0-commandfiles-1-a0882f4af91e1d6b72794cc62bb1b558 [0.08 sec, 4.49 MB]                                                    [debug]
Drush bootstrap phase : bootstrap_drupal_site() [0.08 sec, 4.49 MB]                                                                     [bootstrap]
Initialized Drupal site default at sites/default [0.08 sec, 4.5 MB]                                                                        [notice]
Find command files for phase 2 (max=7) [0.09 sec, 4.5 MB]                                                                                   [debug]
Cache HIT cid: 7.0.0-commandfiles-2-f17fc6bdab2f74278df75194ca483893 [0.09 sec, 4.5 MB]                                                     [debug]
Drush bootstrap phase : bootstrap_drupal_configuration() [0.09 sec, 4.5 MB]                                                             [bootstrap]
Find command files for phase 3 (max=7) [0.09 sec, 4.51 MB]                                                                                  [debug]
sql-query: SELECT 1; [0.09 sec, 4.62 MB]                                                                                                [status]
Executing: mysql --defaults-extra-file=/tmp/drush_CKiVHd --database=site_dev --host=localhost --silent  < /tmp/drush_DG1fIs
  1
Drush bootstrap phase : bootstrap_drupal_database() [0.1 sec, 4.62 MB]                                                                  [bootstrap]
Successfully connected to the Drupal database. [0.11 sec, 5.13 MB]                                                                      [bootstrap]
Find command files for phase 4 (max=7) [0.11 sec, 5.13 MB]                                                                                  [debug]
Drush bootstrap phase : bootstrap_drupal_full() [0.11 sec, 5.13 MB]                                                                     [bootstrap]
Cannot modify header information - headers already sent by (output started at /root/.composer/vendor/drush/drush/includes/output.inc:38)[warning]
common.inc:698 [0.96 sec, 31.9 МБ]
Drush command terminated abnormally due to an unrecoverable error.


推荐答案

听起来可能是这个问题
https://github.com/drush-ops/drush/issues/544

Sounds like it could be this issue https://github.com/drush-ops/drush/issues/544

7.x不适用于PHP 5.3.3

有这里提供的解决方案
https://github.com/drush -ops / drush / issues / 544#issuecomment-62539791

There is a solution provided here https://github.com/drush-ops/drush/issues/544#issuecomment-62539791


基类SqlVersion类没有构造函数一个
的空数组被传递到其后代(Sql6或Sql7)。

The base class SqlVersion class does not have a constructor and yet an empty array is passed into its descendant (Sql6 or Sql7).

要做到这一点,这行

return $ reflectionClass-> newInstanceArgs($ constructor_args);

return $reflectionClass->newInstanceArgs($constructor_args);

应该替换为:

return!empty($ constructor_args)?
$ reflectionClass-> newInstanceArgs($ constructor_args):
$ reflectionClass-> newInstanceArgs();

return !empty($constructor_args) ? $reflectionClass->newInstanceArgs($constructor_args) : $reflectionClass->newInstanceArgs();

您可以升级PHP v5.4或更高版本。

Alternatively you can upgrade PHP v5.4 or higher.

或者,您可以将drush降级为v6.x

Or, you can downgrade drush to v6.x

这篇关于Drush无法识别Drupal(找不到Drupal网站)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆