I run into an issue that the use of an alias returns correct values, but without alias or from remote, I miss the DB connection. Furthermore, the root directory is wrong. The missing DB connection prevents a drush sql:sync run.
Alias file:
$drush sa
'@self.dev':
root: /var/www/html/xyz
uri: 'https://www.abcdef.com'
ssh:
options: '-i xyz.pem'
paths:
drush-script: /home/ubuntu/vendor/bin/drush
files: themes
command:
core:
rsync:
options:
mode: rlptz
running drush status somewhere:
$ drush st
PHP binary : /usr/bin/php7.4
PHP config : /etc/php/7.4/cli/php.ini
PHP OS : Linux
Drush script : /home/ubuntu/vendor/drush/drush/drush
Drush version : 10.6.2
Drush temp : /tmp
Drush configs : /home/ubuntu/.drush/drush.yml
/home/ubuntu/vendor/drush/drush/drush.yml
running drush status with alias:
$ drush @dev st
Drupal version : 9.4.5
Site URI : https://www.abcdef.com
DB driver : mysql
DB hostname : 127.0.0.1
DB port : 3306
DB username : qwertzy
DB name : drupal
Database : Connected
Drupal bootstrap : Successful
Default theme : xyz
Admin theme : seven
PHP binary : /usr/bin/php7.4
PHP config : /etc/php/7.4/cli/php.ini
PHP OS : Linux
Drush script : /var/www/html/xyz/vendor/drush/drush/drush
Drush version : 10.6.2
Drush temp : /tmp
Drush configs : /home/ubuntu/.drush/drush.yml
/var/www/html/xyz/vendor/drush/drush/drush.yml
Install profile : standard
Drupal root : /var/www/html/xyz/web
Site path : sites/default
Files, Public : sites/default/files
Files, Private : /var/private
Files, Temp : /tmp
running drush status in the drupal root: ! Wrong drupal root returned
cd /var/www/html/xyz
$ drush st
PHP binary : /usr/bin/php7.4
PHP config : /etc/php/7.4/cli/php.ini
PHP OS : Linux
Drush script : /home/ubuntu/vendor/drush/drush/drush
Drush version : 10.6.2
Drush temp : /tmp
Drush configs : /home/ubuntu/.drush/drush.yml
/home/ubuntu/vendor/drush/drush/drush.yml
Drupal root : /var/www/html/xyz/web/web
called from remote with alias: ! Again wrong drupal root returned
ubuntu@ip-172-26-13-167 ~ $ drush @dev st
PHP binary : /usr/bin/php7.4
PHP config : /etc/php/7.4/cli/php.ini
PHP OS : Linux
Drush script : /home/ubuntu/vendor/bin/drush
Drush version : 10.6.2
Drush temp : /tmp
Drush configs : /home/ubuntu/.drush/drush.yml
/home/ubuntu/vendor/drush/drush/drush.yml
Drupal root : /var/www/html/xyz/web/web
Connection to 172.26.10.26 closed.
Any advice appreciated how to fix this.