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 May 29 '20 at 7:13

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


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 Feb 12 at 15:41

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',

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 Feb 12 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.