5

Problem

I'm trying to create a drush alias following the excellent example posted here.

EXAMPLE:

$aliases['dev'] = array(
   'root' => '/path/to/drupal',
   'uri' => 'dev.mydrupalsite.com',
 );

MINE:

<?php
$aliases['main'] = array(
    'root' => '/srv/www/mysite/public',
    'uri' => 'main.mysite.net',
  );
?>

According to the example the following two commands are equivalent:

 $ drush @dev status
 $ drush --root=/path/to/drupal --uri=dev.mydrupalsite.com status

And if I run:

$ drush --root=/srv/www/mysite/public --uri=main.mysite.net status

I get a full report. But if I run

 $ drush @main status

I get the error @main status could not be found.

The alias file has been discovered, running drush status in the drupal root shows it has been found. It's ~/.drush/mysite.net.alias.drushrc.php. What have I done wrong?

4

The filename pattern mysite.net.alias.drushrc.php will only be parsed for aliases named @mysite.net. Rename this file to mysite.net.aliases.drushrc.php, and you'll be fine.

3

Do you have more than one alias? If so, I would recommend you rename the file as <youralias>.aliases.drushrc.php . Based on your example, this would give main.aliases.drushrc.php - It doesn't hurt to have only one alias in such file anyway so I would default to aliases.drushrc.php every time, just to be on the safe side.

Next, confirm that the site alias is returned when you type:

$ drush sa

If it's not, clear drush cache to reload all changes:

$ drush cc drush

If this still doesn't work, run the command with the --debug flag and please post the debug log here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.