Using Drush

Selecting the PHP version to execute Drush

Since freistilbox provides several PHP versions, additional setup is required to make sure the correct version is used for executing Drush.

Until we’ve automated this setup, you can add it manually to each website that uses Drush.

NOTICE The following examples are written for PHP 7.3. Modify them accordingly if your website is supposed to use a different version.

After logging in via SSH, create or modify the file .bash_profile in your user’s home directory. It has to (at a minimum) contain the following lines:

export PHPRC="/etc/php/7.3/cli"
export PATH="$HOME/bin:$PATH"

Then, create a symbolic link to the appropriate PHP command line binary inside your website user’s bin directory:

mkdir bin
cd bin
ln -s /usr/bin/php7.3 php

With these changes (and after logging out and in again), the php command will now execute the right version, and tools like Drush will also use this version when they run PHP scripts themselves.

How to create a site alias

Since you have access to a dedicated shell login host, using Drush for Drupal maintenance is easy.

Here is a minimal aliases.drushrc.php:

$aliases['s123'] = array(
  'uri' => '',
  'root' => '/srv/www/freistilbox/home/s123/current/docroot',
  'remote-host' => '',
  'remote-user' => 's123',

As always, replace the parts for site ID (“s123”) and shell login host (“cXXs”) with the actual values corresponding with your website instance.

How to query the actual settings in Drupal 8

Neither the Drupal 8 admin interface nor the Drush cget command will by default reflect configuration settings made in include files such as our configuration snippets:

$ drush cget syslog.settings
identity: drupal
facility: '128'

To get the actual value of a configuration setting, use the --include-overridden switch:

$ drush cget syslog.settings --include-overridden
identity: s1503
facility: '128'