【发布时间】:2014-07-14 14:10:52
【问题描述】:
我遇到了客户的 Drupal 网站问题。他安装了许多 D6,还有一个他刚刚开始的新 D7。 所有这些网站都在同一个共享主机包中。
问题在于在 D7 站点上运行某些drush 命令仅。 D6 站点上没有问题。 D7网站上drush up的具体错误如下:
foo@bar [~/www/foo]# drush up
Command pm-update needs a higher bootstrap level to run - you will need to invoke drush [error]
from a more functional Drupal environment to run this command.
Command pm-update needs the following modules installed/enabled to run: update. [error]
The drush command 'up' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured database. In
this case you can select another site with a working database setup by specifying the URI
to use with the --uri parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be wrong or the php-cli may
have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
Drupal version : 7.28
Site URI : http://default
Database driver : mysql
Database username : username_foo
Database name : database_foo
PHP configuration :
PHP OS : Linux
Drush version : 7.0-dev
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Drupal root : /home/foo/www/foo
Site path : sites/default
我能找到的一切(实际上是错误消息中的link)都说解决方案是将settings.php文件中的host值从localhost更改为127.0 .0.1。但是,这不是我们的解决方案。
- 前端站点连接数据库没有问题,
drush本身在很多情况下似乎也是如此。 -
drush sql-connect将生成一个可用于连接 MySQL 的字符串。 -
drush sql-cli将成功连接 MySQL -
settings.php文件肯定位于名为default(路径:www/foo/sites/default)的文件夹中,我在指定--root和--uri选项时遇到完全相同的错误。 - Drush 最初是一个 ~5.x 版本,它也有同样的问题。我们更新到 ~7.x 以尝试消除错误。
settings.php中的主机值一直是localhost和127.0.0.1,结果同样糟糕。
我们已验证 MySQL 可通过 PHP CLI 中的套接字使用。 Drush 是最新的并且是全新安装的。 Drupal 7 站点是全新安装的。
我很茫然。为什么这适用于 D6 站点,而不适用于 D7?有什么建议吗?
【问题讨论】: