尝试安装我的第一个drupal模块。由于“FTP”错误导致本书无法正常工作,因此我安装了drush。下载似乎现在工作enable命令给我这个错误。我是ubuntu和drupal的每个部分的菜鸟。救命。感谢。
NNH@comp:/var/www/drupal$ sudo drush en module_filter
Command pm-enable needs a higher bootstrap level to run - you will [error]
need invoke drush from a more functional Drupal environment to run
this command.
The drush command 'en module_filter' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This error often occurs when Drush is trying to bootstrap a
site that has not been installed or does not have a configured
database.and tried it.
Drush was attempting to connect to :
Drupal version : 7.14
Site URI : http: //default
Database driver : mysql
Database hostname : localhost
Database username : drupal7
Database name : drupal7
Default theme : garland
Administration theme: garland
PHP configuration :
Drush version : 5.3
Drush configuration:
Drupal root : /var/www/drupal
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
File directory path: sites/default/files
%paths : Array
You can select another site with a working database setup by
specifying the URI to use with the --uri parameter on the command
line or $options['uri'] in your drushrc.php file.
可能相关:
NNH@comp:~$ sudo dpkg-reconfigure -plow phpmyadmin
[sudo] password for NNH:
/usr/sbin/dpkg-reconfigure: phpmyadmin is broken or not fully installed
答案 0 :(得分:2)
Drush基本上是一个命令行界面,用于交互,管理和配置Drupal及其模块。因此,如果您希望将Drush用于与数据库相关的任何操作,则必须通过循环地址,即。,localhost。但似乎Drush将 127.0.0.1 理解为循环地址,但不是 localhost 。
只需在settings.php中定义这些内容,即可让Drush继续进行任何与数据库相关的操作。
而不仅仅是这个
'host' => 'localhost',
使用此,
'host' => php_sapi_name() == 'cli' ? '127.0.0.1' : 'localhost',
答案 1 :(得分:1)
您通常会收到错误
命令pm-enable需要更高的引导级别才能运行 - 你会的 [错误]需要从更具功能性的Drupal环境调用drush 运行此命令。
运行命令时,您不在站点的根目录中。
如果错误仍然存在,请尝试直接从提示符连接到MySQL。尝试使用Drush输出中的值进行连接,即:
mysql -hlocalhost -udrupal7 -p drupal7
如果它正常工作并且网站正在运行,那么您很可能排除数据库连接问题。假设您在自己的盒子上进行本地开发,可以尝试在settings.php中将localhost更改为127.0.0.1。这似乎帮助了一些人。
网站URI设置似乎有点奇怪。