Wondering how to install Drush on Drupal 8? We can help you.
A free & open-source CMS to create & manage many websites, the effective use of Drupal 8 requires an interactive shell interface like Drush is important.
It’s a very powerful tool that performs various tasks using commands in the terminal. However, installing Drush in Drupal 8 is quite tricky & requires good knowledge.
As part of our Server Management Services, we assist our clients with several Drupal queries.
Today, we’ll see how our Support Engineers set up “Drupal 8 install Drush” & fix the related issues.
What is Drush?
The name Drush stands for DRUpal SHell. It’s a command-line utility to communicate with Drupal CMS.
Drupal 8 uses Drush to manage &
- Detect errors and fix them.
- Bypass using the interface when the Drupal backend is unavailable.
- Do regular maintenance and updates.
For users who need speed & flexible workflow, Drush allows them to run scripts from the command line & manages Drupal.
How to Install Drush on Drupal 8
Since it is a command-line interface, and easy to process, the Drush scripting interface primarily works on the command line.
Moving ahead, let’s see how our Support Engineers install Drush in Drupal 8.
- First, we login into the server using SSH.
ssh firstname.lastname@example.org -p 22
- Then, we change the directory to the user’s home directory.
- Next, we download the latest version of Drush using the following command.
- Next, we extract the archive file like this.
tar zxvf drush-8.x-6.0-rc4.tar.gz
- Finally, we run the command to clear the Drupal caches.
drush cc all
The installation process is complete. Now, the user can use the Drush command easily.
Troubleshooting common Drush on Drupal 8 installation errors
From our experience in managing servers, we often see errors reported by customers while installing Drush in Drupal 8.
Let’s take a closer look at the causes & how our Support Engineers fix them.
Incompatible Drush version
Recently, one of our customers after installing Drush in Drupal 8 tried to update Drupal modules with the command
drush ups. However, it resulted in an error like this.
Command pm-updatestatus needs a higher bootstrap level to run - you [error] will need to invoke drush from a more functional Drupal environment to run this command.
In order to solve this error, our Support Engineers performed the following steps:
- Initially, we check the status by running the following command.
- By analyzing we found that the Drush version was 8.0.3. Generally, Drupal 8 supports higher versions of Drush 8.1.
- Then we remove & install the latest version of Drush.
- Next, we run the PHP file to verify the status
/usr/local/php5.5/bin/php drush.phar status
- Finally, we ensure the correct version of Drush is installed by running this command.
That fixed the error & the user could run the Drush command without any failure.
Similarly, even after installing Drush properly, we may face issues with the site due to a lower value in the PHP parameter.
We may also receive an error on the website indicating that the memory limit has been reached & it results like this:
PHP Fatal error: Allowed memory size of ### bytes exhausted
PHP allows a default amount of memory to process a website. Sometimes, a website needs more than the default amount of memory.
To get around this error, our Support Engineers increased the memory limits.
- Initially, we open the site’s configuration file.
- Then, we locate the line memory limit and raise the value to 500Ms.
- Finally, we save the file to reflect the changes made.
That’s how we fixed the problem with Drush in Drupal 8.
[Having trouble with Drush in Drupal 8? We’ll fix it for you.]
In short, Drush is a command-line utility to manage Drupal CMS. Today, we saw how our Support Engineers installed Drush in Drupal 8 and fixed the related issues.