Drush - Define Site URI on Drupal 7 development site

kenneth

Authored on

Image

Something we need to login into our Drupal site without type any credentials, then Drush provides us an easy way to achieve it by executing:

drush uli

If we execute it on our local environment, we would see an message like this:

drush uli

It means, Drush hasn't define Site URI option to current Drupal installation.

We can make to Drush awares about specific options by creating a Drush runtime config file, we can see an example file inside our Drush installation folder, just like this:

drushrc examples

Otherwise, we always can find it online.

We only need to create a file named "drushrc.php" inside "sites/default" folder, then we need to define $option['uri'] with our current URI value as a string, in my case it will looks like:

// Setup current local URI.
$options['uri'] = 'http://keboca.dev/';

As soon as we execute "Drush status", we will notice our Site URI option reflected,

drush st

Then next time we generate a login link by Drush, we can see the difference,

drush user-login

drush user-login

Last Drush version is able to open a new tab in our default browser, reason we can see the following message: "Created new window in existing browser session". I really hope it helps you to speed your local development.