欢迎各位兄弟 发布技术文章
这里的技术是共享的
点击打开链接
有问题 见 /node-admin/8557
1. Go to somewhere you want to put the download files temporarily.$ cd ~/Desktop
2. Download the latest Drush package.$ curl -O http://ftp.drupal.org/files/projects/drush-7.x-5.8.tar.gz
3. Uncompress it.$ tar -zxf drush.tar.gz
4. Move the drush folder to the suggested directory. You may need to input administrator password.$ sudo mv drush /usr/local/lib/
5. Make it executable$ sudo chmod u+x /usr/local/lib/drush/drush
6. Create link$ sudo ln -s /usr/local/lib/drush/drush /usr/bin/drush
And now you can go to a Drupal installation directory and try$ drush help
If you have Homebrew, it supports Drush as well.$brew install drush
来自 http://blog.csdn.net/wjc19911118/article/details/8970412
执行 drush 发现有错误 一步步发现问题 解决问题
见 /node-admin/8557 进行解决问题
2)执行 drush cc all drush cc all 清空所有缓存
报错
Command cache-clear needs a higher bootstrap level to run - you will [error] need invoke drush from a more functional Drupal environment to run this command.
php 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.
3) 此时 我执行 drush cc all --uri=http://网站网址
Drupal version : 6.2
Site URI : http://default
Database driver : mysql
Database hostname : localhost 网上说 settings.php 中 连接数据库用 l27.0.0.1代替localhost 但是我发觉我这里不行
Database username : xxx
Database name : xxx
Default theme : garland
Administration theme: garland
PHP configuration :
Drush version : 4.5
Drush configuration:
Drush alias files :
Drupal root : /var/www/vhosts/abc.net/subdomains/bbb/httpdocs
Site path : sites/default
Modules path : sites/all/modules
Themes path : sites/all/themes
File directory path: sites/default/files
%paths : Array
发觉仍有错
Command cache-clear needs a higher bootstrap level to run - you will [error] need invoke drush from a more functional Drupal environment to run this command.
php 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.
Failed loading /www/wdlinux/apache_php-5.5.9/lib/php/extensions/no-debug-non-zts-20121212/opcache.so: /www/wdlinux/apache_php-5.5.9/lib/php/extensions/no-debug-non-zts-20121212/opcache.so: undefined symbol: zend_new_interned_string
仔细查了一下 执行 在putty上 php-v 发现是php版本不对 (这里是 php 5.3)(而通过网页 phpinfo发现是 5.5.9)
php -v 它执行的是 /usr/bin/php 我备份一下它 用 5.5.9的版本覆盖它 就好了
就可以执行 drush cc all 了.
4)如果还有错的 drush command terminated abnormally due to an unrecoverable error
话 就是自己写的 hook_init hook_boot 不能正常在 cli模式下运行 详情见 /node-admin/8575
我学Drupal已经6年多了,很早以前就知道Drush,但是由于不懂Linux,所以很少在实际的项目中使用Drush,曾经在windows下面安装过Drush,但是每次使用,总是报一大堆的警告信息,后来也就不用了。最近开始学习Linux,其实也是想学习一下Drush。
先说安装,我使用的是centos,所以找到了一篇文挡,https://drupal.org/node/2009426,按照里面的操作进行,先是第一步:
sudo wget --quiet -O - http://ftp.drupal.org/files/projects/drush-7.x-4.5.tar.gz |
sudo tar -zxf - -C /usr/local/share
在这里的时候,我先执行了:
cd /usr/local/share
sudo wget --quiet -O - http://ftp.drupal.org/files/projects/drush-7.x-5.9.tar.gz
我将drush的版本替换为了最新的。接着,我执行:
sudo tar -zxf - -C /usr/local/share
结果命令不动了,好像死机了。这个时候,我才发现,第一行命令后面有一个|,这是Linux里面的管道,这两个命令是放在一起的,第一个命令的执行结果,将会传递给第二个命令作为后者的输入。
我不得不关闭ssh窗口,重新打开,回到刚才的目录,然后执行:
tar zxvf drush-7.x-5.9.tar.gz
程序解压缩成功。
接下来是创建软链接,我按照文档中的命令输入:
ln -s /usr/local/share/drush/drush /usr/local/bin/drush
创建成功。
接下来,输入命令:
drush
下面显示了一大堆的信息:
Execute a drush command. Run `drush help [command]` to view command-specific
help. Run `drush topic` to read even more documentation.
Global options (see `drush topic core-global-options` for the full list):
-d, --debug Display even more information,
including internal messages.
-h, --help This help system.
-ia, --interactive Force interactive mode for commands
run on multiple targets (e.g. `drush
@site1,@site2 cc --ia`).
-n, --no Assume 'no' as answer to all
prompts.
--php=</path/to/file> The absolute path to your PHP
intepreter, if not 'php' in the
path.
-p, --pipe Emit a compact representation of the
command for scripting.
-r <path>, --root=<path> Drupal root directory to use
(default: current directory).
-s, --simulate Simulate all relevant actions (don't
actually change the system).
-l <http://example.com:8888>, URI of the drupal site to use (only
--uri=<http://example.com:8888> needed in multisite environments or
when running on an alternate port).
-v, --verbose Display extra information about the
command.
--version Show drush version.
-y, --yes Assume 'yes' as answer to all
prompts.
Core drush commands: (core)
archive-dump (ard, Backup your code, files, and database into a single
archive-backup, arb) file.
archive-restore Expand a site archive into a Drupal web site.
。。。。。。。
文档上面,到这里的时候,是不成功的,还需要执行以下操作:
打开bash_profile文件,将里面的:
=/hsphere/shared/bin:/hsphere/shared/sbin:/hsphere/local/var/vpopmail/bin:/usr/local/bin:/usr/local/sbin:$PATH:$HOME/bin
修改为:
PATH=/hsphere/shared/bin:/hsphere/shared/sbin:/hsphere/local/var/vpopmail/bin:/usr/local/bin:/usr/local/sbin:/hsphere/shared/php53/bin:$PATH:$HOME/bin
我对hsphere不是很熟悉,确切的说,是第一次听说。不知道现在是否安装成功了。所以,我又Google了一下,找到了另一篇文章,http://www.webmaster.net/how-install-drush-centos-6x,上面是基于PEAR安装的,安装过程更简单,上面说,只要drush,命令成功执行,就是安装成功了,这篇文章的最后,想要使用下面的命令:
pico /etc/drush/drush.ini
创建drush.ini文件,并在里面添加以下代码:
error_reporting = E_ALL | E_NOTICE | E_STRICT
我没有执行成功,因为pico这个命令不存在。不过还是有点收获的,觉得自己已经安装成功了。导航到一个Drupal的根目录下,执行命令:
drush dl zen
竟然成功了,得到以下信息:
Project zen (7.x-5.4) downloaded to [success]
/var/www/html/ebook/sites/all/themes/zen.
执行:
drush dl panels
也成功了,得到以下信息:
Project panels (7.x-3.3) downloaded to [success]
/var/www/html/ebook/sites/all/modules/panels.
Project panels contains 4 modules: panels_ipe, panels_mini, panels_node, panels.
还把里面子模块的机读名字都给列出来了,方便下面的操作。
执行命令:
drush en panels
在下面的提示信息中,输入y,表示同意。
The following extensions will be enabled: panels
Do you really want to continue? (y/n): y
panels was enabled successfully. [ok]
Panels模块安装成功。
自己检查了一下Drupal后台:也成功了。
当欧美的Drupal程序员,已经用上拖拉机的时候,我们还在刀耕火种的阶段。这是我经常说的。