You are here

drush on a remote host

to the uninitiated drush is the drupal shell. it allows you to do stuff to your drupal site from the command line and it requires

  • ssh access on the remote host or server
  • drush to be installed on the remote host on server

i had loads of errors while setting up drush and the following code is a summary of what i had to do to fix everything to get drush to work remotely from my laptop

# ssh to the server and run the following cmds
mkdir $HOME/www/$SUBDOMAIN/vendor/bin
cp /opt/cpanel/composer/bin/composer $HOME/www/$SUBDOMAIN/vendor/composer/composer
ln -s $HOME/www/$SUBDOMAIN/vendor/composer/composer $HOME/www/$SUBDOMAIN/vendor/bin/composer
$HOME/public_html/$SUBDOMAIN/vendor/composer/composer global require drush/drush -d $HOME/public_html/$SUBDOMAIN/
chmod +x $HOME/www/$SUBDOMAIN/vendor/drush/drush/drush
chmod +x $HOME/www/$SUBDOMAIN/vendor/drush/drush/drush.launcher
wget -o $HOME/.drush/drush.ini
# in $HOME/.bashrc
echo "export DRUSH_INI=\"\$HOME/.drush/drush.ini\"" >> $HOME/.bashrc
sed -i 's/;open_basedir/open_basedir/g' $DRUSH_INI
sed -i 's/;disable_functions/disable_functions/g' $DRUSH_INI

as you can see, i was working on a subdomain when i had to run this through