I'm using Drupal 9 and Drush 11. I have two hosts, one for local testing (www.en9-local.pglatz.com
) and a remote production server (www.electronovelty.com
).
When I run drush status from either of these hosts, I see Site path is set to sites/default. How do I tell drush which settings.php to use? I tried using the uri argument on the command line; it does find the proper site path, but is also giving an error:
% drush status --uri=www.electronovelty.com
sh: 1: ^www.en9-local.pglatz.com$: not found
sh: 1: ^www.electronovelty.com$: not found
...
Ideally, it wouldn't involve editing files on the remote host, but set with a cmd line argument, env variable, or other setting outside the Drupal installation.
drush cr
to clear your local site's cache anddrush @myalias cr
to clear your remote site's cache. If this is not a multi-site, settings.php always resides in sites/default dir. If this is a multi-site and you have another settings.php in sites/subsite dir for example, executedrush cr -l subsite
to execute your local subsite's instance cache.cd
into the right local directory before executing a Drush command there, and maybe a second argument for the corresponding remote alias. And I think Drush still takes the--root
option to point to a certain dir on your local, doesn't it?-l
then.drush cr -l www.en9-local.pglatz.com
anddrush cr -l www.electronovelty.com
. (Although I'm not sure if this setup is a good idea in general.)-l
. Likedrush cr -l www.en9-local.pglatz.com
.