Using Drush ( Power tool for Drupal ) in Windows XP

At first when I saw drush i thought it’s not that handy as it seems to be. I thought some geek created this just to have fun and feel command line flexibility. But after i dig deeper i found it amazing. If you understand how to use drush you will be amazed by it’s power.

Now what is drush .. drush is a command line shell and Unix scripting interface for Drupal. as stated in here.  The most noteable features of drush from my point of view is :   module enable/disable, update script,  module download, cache clear. Just from command mode i can check latest version of module and dl them and enable them in just simple 3 to 4 commands.

I am not going to briefly explain drush functionality but will try to explain how to run drush in your system in this case Windows XP ( :P ) .  Here it goes:

  • Download the latest version of drush from drupal
  • Now open Command prompt and check and set initial settings.
    • Type ‘php’ and press enter if php command is not found then set php.exe path in your Environment
    • Also add the drush path into the environment path
    • By Closing and opening  command prompt again. check by typing ‘drush’
    • If by typing ‘drush’ shows error regarding drush.php open drush.bat file in an editor and  add the abosulute path of drush.php in that bat file.
    • This will fix the drush.php path problem.
  • Let’s play with drush. Open command prompt again and traverse to a drupal installation for example:  ’cd d:/www/mydrupal’  and then type  ’drush status’. It will show initial settings of mydrupal installation. If it does not check for settings and environment path.

Drush has some nice extensions. You can play around with them. Here is another simple tip for you. If you study drush you will definately like “drush -v dl ” and ‘drush info” command. “drush info <module_name>” shows particular modules downloadable version and “drush -v dl” can help you to download and copy the file directly into your installation by just 1 single command. But to use ‘drush -v dl’ is little tricky. It uses gzip and tar command to extract the downloaded module file. You can download gzip and tar exe for windows from here.

It seems some ppl did able to use gzip and tar without any hasle but in my case i had trouble with tar. So i hacked into the core of drush and changed the tar command into izarce . If you face problem with tar then go with izarce. It worked for me.

Oops. To use izarce first install the command line version. Then add the izarce location into your environment path. THen goto drush directory and open file ‘drush\commands\pm\package_handler\wget.inc’.  Now find the line which says:

drush_shell_exec(”tar -xf $tarpath -C \”$path\”");

Now replace this with

drush_shell_exec(”izarce -e -d -p”. $path . ” $tarpath”);

It worked for me hope this does for you too. Have a nice drushed life.

[ N.B. At first i tried to use 7zip instead of izarce and gzip+tar but they have some absolute path issue; the solution of which i could not find. So, if you do know of any solution better than this do let me know.

For setting environment   press "windows key+ pausebreak" >> Advanced >> 'environment variable' >> now find variable path .. :) enjoy]

Leave a Comment

CodeIgniter and GET Method working to-gether

This is a personal note kind of post.. So, those who knew already about this… just can skip.. :) . But for a short summary, to use the power of GET method by not setting the CI as Query string based URL. 

Target To achieve: 

http://localhost/myapp/mycontroller/mymethod/?possible=yes

create file MY_Input.php in your application/library/
[ Reason: SO that CI does not destroy GET Method ] 

<?php
class MY_Input extends CI_Input {
    function _sanitize_globals()
    {
        $this->allow_get_array = TRUE;
        parent::_sanitize_globals();
    }    
Change following variable in your Config.php 
$config['permitted_uri_chars'] = ‘a-z 0-9~%?=&.:_\-’;
$config['index_page'] = “”;
.htaccess File [ Thanks to Adnan ]
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|img|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 
Some Workaround: 
1. If you want to accept GET data in your controller’s index method.. have to use 
http://localhost/myapp/mycontroller/index/?possible=yes
Reference:
It worked out fine for me. My CI version is : 1.6.3

Comments (2)

In the world of twitter

I have just opened an account in twitter. http://twitter.com/neotohin .. I don’t know how long i’ll survive but let’s see. 

Leave a Comment

Some Firefox Add-on that makes me say ‘WOW’

Here i am mentioning some of the firefox add-ons which makes me say ‘Wow’ in a not geekish way.  Though this is late but i found them just today and could not restrain myself from sharing these to all :D .

 

Cooliris
Full-Screen, 3D — Cooliris transforms your browser into a lightning fast, cinematic way to browse online photos and videos.

 This takes image/video searching   in a new height. Must see.

FoxTab

It’s better than FastDial in sense of look … But i like them both. :)  

Let me know if you have seen such kind of innovative add-ons or application .. Do share. ;)

Leave a Comment

Older Posts »