2

I've been trying to set up some Drush aliases. However, when I try to run any command, it will echo the contents of all aliases files, and drush sa simply returns the contents of those files twice, and then the @none, @self and @default aliases (since I'm in the folder of a Drupal installation). When trying to run any command with an alias, e.g. drush @local status, I once again get a dump of those files, and finally a Could not find the alias @local error.

I've tried putting the aliases in ~/.drush/aliases.drushrc.php and in ~/.drush/local.aliases.drushrc.php. In the latter case, I tried two formats:

$aliases['local'] = array(
    'root' => '/home/user/subdomain/public_html',
    'uri' => 'subdomain.domain.com'
);

and

@code
    $options['uri'] = 'subdomain.domain.com';
    $options['root'] = '/home/user/subdomain/public_html';
@endcode

both without any different effect, apart from different contents being dumped. No other errors are thrown, it seems. I've also done a drush cache-clear all after each attempt.

Any thoughts as to what might cause this?

6

Your error was quite simple; you forgot to put <?php at the top of your alias file.

  • 1
    Oh man. I simultaneously hope and really don't hope that is the case, but it makes a lot of sense. Will test in an hour or 2... – Erik S Nov 28 '15 at 21:18
  • Wow! None of the tutorials that I read about the aliases file mentioned the need for the opening <?php tag but I guess that makes sense. THANK YOU. – oranges13 Jun 2 '16 at 21:29

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.