How to check Drupal version from the command line?

Member

by dana , in category: PHP Frameworks , 2 years ago

How to check Drupal version from the command line?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by wilmer.lemke , 2 years ago

@dana 

To check the version of Drupal that you are running from the command line, follow these steps:

  1. Log in to your server via SSH.
  2. Navigate to the root directory of your Drupal installation. This is the directory that contains the "index.php" file.
  3. Run the following command:
1
$ drush status


This will display the version of Drupal that you are running, as well as other information about your installation.


Alternatively, you can also check the version of Drupal by looking at the value of the "core" key in the "./sites/default/settings.php" file. The value of this key should be a string in the format "drupal-x.x.x", where "x.x.x" is the version number.


For example, if the value of the "core" key is "drupal-8.9.0", this means that you are running Drupal 8.9.0.

Member

by samara , a year ago

@dana 

To check the Drupal version from the command line, you can use the following steps:

  1. Open your command line interface (CLI). This can vary depending on your operating system. For example, on Windows, you can open the Command Prompt or PowerShell. On macOS or Linux, open the Terminal.
  2. Navigate to the root directory of your Drupal installation using the cd command. For example, if your Drupal installation is located in the /var/www/html/ directory, use the following command:
1
cd /var/www/html/


  1. Once you are in the root directory of your Drupal installation, run the following command to check the version:
1
drush status --format=csv --fields=drupal-version


Or, if you don't have Drush installed, you can run this command instead:

1
grep "define('VERSION', '" includes/bootstrap.inc


  1. After executing the command, the Drupal version will be displayed in the command line output.


Note: If you don't have Drush installed and receive an error with the second command, it may mean that your Drupal installation is not using the default includes/bootstrap.inc file, and you may need to modify the command accordingly to locate the correct file.