Today, I am getting an error message when I run the Drush download or update command.

drush up -y captcha

fails with

Unable to extract /.tmp/drush_tmp_1582749966_5e56d90e14736/captcha-7.x-1.7.tar.gz. Unknown archive format. [error]

When I changed the Drush temp directory I still get the same error message. Also, same error message using php7.2, php7.3, php7.4

Why does this happen?

  • Even if the issue is resolved, it makes sense to tell which version of Drush you used - and Drupal version. Added: Drupal 7 I see now from the captcha version.
    – hansfn
    Commented May 29, 2020 at 7:13

6 Answers 6


I had the same issue. I'm on PHP 7.4.5 The issue is fixed by upgrading drush from 8.1.15 to 8.3.3:

Change (update to 8.3.3) Drush-Version in



composer update

  • Ran into the same issue this afternoon. Updating to 8.3.3 was the fix. Thanks. Commented Oct 25, 2022 at 23:05
  • This worked for me. Make sure you do the composer update in the correct place where your composer.json resides. Commented Feb 28, 2023 at 18:51

I ran into this issue recently, which is caused by the fact that the PHP finfo function in PHP 7.4 returns mimetype application/gzip for gzip-compressed files instead of mimetype application/x-gzip as earlier PHP versions had done. A bug report was filed, but it was decided that the change was an improvement so was not fixed (see https://bugs.php.net/bug.php?id=79681).

Since my system does not have multiple PHP versions installed, I could not use either of the solutions involving the use of earlier PHP versions.

Since my system repositories do not yet include drush 8.3.3 which is reported to resolve this issue, I was not able to use that solution either.

Instead, I patched drush locally (located in /usr/share/drush on my system) with the following patch, which worked for me:

--- includes/drush.inc.20180206 2020-09-21 07:49:26.161595136 +0200
+++ includes/drush.inc  2020-09-21 07:49:37.012533799 +0200
@@ -891,8 +891,8 @@
   if (class_exists('finfo')) {
     $finfo = new finfo(FILEINFO_MIME_TYPE);
     $content_type = $finfo->file($filename);
+    drush_log(dt('Mime type (finfo) for !file is !ct.', array('!file' => $filename, '!ct' => $content_type)), LogLevel::DEBUG);
     if ($content_type == 'application/octet-stream') {
-      drush_log(dt('Mime type for !file is application/octet-stream.', array('!file' => $filename)), LogLevel::DEBUG);
       $content_type = FALSE;
@@ -972,6 +972,7 @@
 function drush_file_is_tarball($path) {
   $content_type = drush_attempt_mime_content_type($path);
   $supported = array(
+    'application/gzip',

The accepted answer didn't work for me, but changing the default PHP version before doing the update did.

sudo update-alternatives --set php /usr/bin/php7.3

Perform the update, then set the PHP version back.

sudo update-alternatives --set php /usr/bin/php7.4

I ran into a permission error afterward which was fixed with the Drupal recommendations:

cd /path/to/site
chown -R drupal-user:www-data .
find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
find . -type f -exec chmod u=rw,g=r,o= '{}' \;
cd /path/to/site/sites
find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
for d in ./*/files
   find $d -type d -exec chmod ug=rwx,o= '{}' \;
   find $d -type f -exec chmod ug=rw,o= '{}' \;
find . -name .htaccess -type f -exec chmod u=rw,g=r,o= '{}' \;

Everything works now.

  • This worked for me, but I had to change the php version to 7.1, then change back to 7.4 after performing the update with drush.
    – arnoldbird
    Commented Feb 12, 2021 at 15:41

The first paragraph of the answer by @Eric Negaard well explains why it fails.

And the answer by @Hermann Schwarz should work well for a project-specific drush.

Here is how to deal with it if you are using global drush in you environment (and maybe Drupal 7).

If you follow the standard installation procedure of drush, you are probably using the tool cgr developed by Greg Anderson (see justification) to manage your global drush.

Then, cgr update drush/drush would do a job, which updates drush to say, 10.4.2 as of 2021-04-14, providing you are using Drupal 8 or above. However, this command would not work well with Drupal 7, because Drush Version 10 (or 9) does not support Drupal 7.

If you are using Drupal 7, do as follows - basically you must uninstall drush first and reinstall your desired version.

cgr remove drush/drush
cgr drush/drush:8.4.6

where 8.4.6 is the latest (or your chosen) version of drush Ver.8. See drush-ops/drush Releases on Github to check out the latest releases.

For your information,

cgr info drush/drush | grep -i versions

would return the version of your cgr-installed drush (In my environment, when its version was 10, it did not match with the result of drush --version, which confused me).

  • 1
    Thank you. Updating drush with cgr worked perfect for me.
    – C13L0
    Commented Nov 30, 2021 at 19:11
  • 1
    much later, this still works. I downgraded drush to exactly 8.4.6, but here using composer global require drush/drush:8.4.6 - and it solved the issue, temporarily.
    – nerdoc
    Commented Jan 6, 2023 at 19:07

It turned out that Drush was using PHP 7.4 instead of PHP 7.3 on command line. Adding export DRUSH_PHP=/php_path to bash_profile resolved the issue. Updating and downloading Drupal modules is working again.

  • Didn't resolve the issue for me.
    – arnoldbird
    Commented Feb 12, 2021 at 15:05

I solved it using an older version of php as stated here:


and then after loging in again:

$ drush73 pm-update

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.