Composer / Wp-Packagist Failure to download on Trellis deploy

Hello! Long time listener, first time caller.

We’ve been scratching our head about this error: When deploying our Trellis+Bedrock+Sage project to a Digital Ocean droplet, we’ve started getting this error (It had been deploying successfully previously):

TASK [deploy : Check for composer.json in project root or project_subtree_path] 
ok: [xxx.xxx.xxx.xxx]

TASK [deploy : Fail if composer.json not found] ********************************
skipping: [xxx.xxx.xxx.xxx]

TASK [deploy : Install Composer dependencies] **********************************
fatal: [xxx.xxx.xxx.xxx]:  FAILED! => {"changed": true, "cmd": ["composer", "install", "--no-ansi", "--no-dev", "--no-interaction", "--no-progress", "--optimize-autoloader", "--no-scripts"], "delta": "0:00:12.444034", "end": "2016-02-24 06:18:25.320677", "failed": true, "rc": 1, "start": "2016-02-24 06:18:12.876643", "stderr": "Loading composer repositories with package information
Installing dependencies from lock file
  - Installing johnpbloch/wordpress (4.4.2)
    Downloading
    Failed to download johnpbloch/wordpress from dist: Could not decompress the archive, enable the PHP zip extension.
The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini
    Now trying to download from source
  - Installing johnpbloch/wordpress (4.4.2)
    Cloning fe9320de0793602084c600e22c0c5e0bb601a264

  - Installing wpackagist-plugin/better-wp-security (5.3.0)
    Downloading
    Failed to download wpackagist-plugin/better-wp-security from dist: Could not decompress the archive, enable the PHP zip extension.
The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini
    Now trying to download from source
  - Installing wpackagist-plugin/better-wp-security (5.3.0)
    Checking out tags/5.3.0

                                     
  [RuntimeException]                 
  Package could not be downloaded,   
  sh: 1: svn: not found              
                                     

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...", "stdout": "", "stdout_lines": [], "warnings": []}

This happens when any plugin from the wp-packagist repository is in composer.json, and doesn’t happen locally. If we remove wp-packagist items from composer.json, the deploy is successful.

And our wordpress_sites.yml config is below for reference. (Same error happens with or without hooks committed in the staging or production branches of the repo)


# # Documentation: https://roots.io/trellis/docs/remote-server-setup/
project_pre_build_commands_local:
   - path: "{{ project.local_path }}/web/app/themes/gptheme"
     cmd: npm install
   - path: "{{ project.local_path }}/web/app/themes/gptheme"
     cmd: bower install
   - path: "{{ project.local_path }}/web/app/themes/gptheme"
     cmd: gulp --production

project_local_files:
  - name: compiled theme assets
    src: "{{ project.local_path }}/web/app/themes/gptheme/dist"
    dest: web/app/themes/gptheme

wordpress_sites:
  example.com:
    site_hosts:
      - xxx.xxx.xxx.xxx
    local_path: '../site' # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@bitbucket.org:nickxd/example.git
    branch: staging
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo (above) if it is not the root (like the roots-example-project structure)
    multisite:
      enabled: false
      subdomains: false
    ssl:
      enabled: false
    cache:
      enabled: false
      duration: 30s
    env:
      disable_wp_cron: true
      wp_home: http://xxx.xxx.xxx.xxx
      wp_siteurl: http://xxx.xxx.xxx.xxx/wp
      wp_env: staging
      db_name: example_staging
      db_user:example_staging_dbuser
      # Define the following variables in group_vars/staging/vault.yml
      # db_password:
      # auth_key:
      # secure_auth_key:
      # logged_in_key:
      # nonce_key:
      # auth_salt:
      # secure_auth_salt:
      # logged_in_salt:
      # nonce_salt:


What’s your Trellis version?

This was pulled around 2/16, so we’re on 0.9.5 with the Fix #410 patch.

Can you double check if your version includes https://github.com/roots/trellis/pull/492?

My deploy is failing at the last hurdle. I’m using a DO Ubuntu Droplet and have provisioned the server with trellis. I have added some plugins to my composer.json but is fails with the follow errors:

TASK: [deploy | Install Composer dependencies] ******************************** 
     failed: [188.166.189.70] => {"changed": true, "cmd": ["composer", "install", "--no-ansi", "--no-dev", "--   no-interaction", "--no-progress", "--optimize-autoloader", "--no-scripts"], "delta": "0:00:05.606855",   "end": "2016-02-24 13:09:42.056628", "rc": 1, "start": "2016-02-24 13:09:36.449773", "warnings": []}
     stderr: Loading composer repositories with package information
    Installing dependencies from lock file
    - Installing deliciousbrains/wp-migrate-db-pro (1.5.5)
    Downloading

                                                                          
    [RuntimeException]                                                      
    Could not decompress the archive, enable the PHP zip extension.         
    The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini  
                                                                          

    install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-        installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-        autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...

It seems as though the PHP zip extension isn’t enabled.
I have searched and cannot find how to enable it.
without the plugins there are no issues.

my composer.json

  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "A modern WordPress stack",
  "homepage": "https://roots.io/bedrock/",
  "authors": [
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    }
  ],
  "keywords": [
    "bedrock", "roots", "wordpress", "stack", "composer", "vagrant", "wp"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "config": {
    "preferred-install": "dist"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "http://wpackagist.org"
    },
    {
            "type": "package",
            "package": {
                "name": "deliciousbrains/wp-migrate-db-pro",
                "type": "wordpress-plugin",
                "version": "1.5.5",
                "dist": {
                    "type": "zip",
                    "url": "https://deliciousbrains.com/dl/wp-migrate-db-pro-latest.zip?licence_key=**********************&site_url=example.com"
                },
                "require": {
                    "composer/installers": "v1.0.7"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "deliciousbrains/wp-migrate-db-pro-media-files",
                "type": "wordpress-plugin",
                "version": "1.4.3",
                "dist": {
                    "type": "zip",
                    "url": "https://deliciousbrains.com/dl/wp-migrate-db-pro-media-files-latest.zip?licence_key=**********************&site_url=example.com"
                },
                "require": {
                    "composer/installers": "v1.0.7"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "deliciousbrains/wp-migrate-db-pro-cli",
                "type": "wordpress-plugin",
                "version": "1.2.3",
                "dist": {
                    "type": "zip",
                    "url": "https://deliciousbrains.com/dl/wp-migrate-db-pro-cli-latest.zip?licence_key=**********************&site_url=example.com"
                },
                "require": {
                    "composer/installers": "v1.0.7"
                }
            }
        }
  ],
  "require": {
    "php": ">=5.5",
    "composer/installers": "~1.0.12",
    "vlucas/phpdotenv": "^2.0.1",
    "johnpbloch/wordpress": "4.4.2",
    "oscarotero/env": "^1.0",
    "deliciousbrains/wp-migrate-db-pro": "*",
    "deliciousbrains/wp-migrate-db-pro-media-files": "*",
    "deliciousbrains/wp-migrate-db-pro-cli": "*"
  },
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web/wp"
  }
}

Any help would be great.

@corey I moved your post to this topic since it looks to be the same problem.

@swalkinshaw Same error for me starting late last night after merging 0.9.6 into my setup. I verified that prestissimo is in there too.

An initial merge in of 0.9.6 yields the same error, but we’re now trying with a clean install and deploy to the same server to see how it goes.

Same error still happening.

Set up a fresh install of Trellis and Bedrock only, applied our staging DO credentials and development credentials (using a clean repository for deployment), updated composer.json and updated, rebuilt vagrant box, provisioned the staging server, and deployed to the staging server.

composer.json config is now as follows for testing (and we’ve searched each plugin to see if there were any packages that hadn’t been synced to wp-packagist yet and was happy to see @ben asking the same question last week.)


{
  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "A modern WordPress stack",
  "homepage": "https://roots.io/bedrock/",
  "authors": [
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    }
  ],
  "keywords": [
    "bedrock", "roots", "wordpress", "stack", "composer", "vagrant", "wp"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "config": {
    "preferred-install": "dist"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "http://wpackagist.org"
    }
  ],
  "require": {
    "php": ">=5.5",
    "composer/installers": "~1.0.12",
    "vlucas/phpdotenv": "^2.0.1",
    "johnpbloch/wordpress": "4.4.2",
    "oscarotero/env": "^1.0",
    "wpackagist-plugin/wordpress-seo":"^3.0.7",
    "wpackagist-plugin/open-external-links-in-a-new-window":"^1.3.2",
    "wpackagist-plugin/google-analytics-for-wordpress":"^5.4.6",
    "wpackagist-plugin/posts-to-posts":"^1.6.5",
    "wpackagist-plugin/wp-smushit":"^2.1.3",
    "wpackagist-plugin/better-wp-security":"^5.3.0",
    "wpackagist-plugin/w3-total-cache":"^0.9.4.1",
    "wpackagist-plugin/post-type-archive-links":"^1.3.1",
    "wpackagist-plugin/tinymce-advanced":"^4.2.8",
    "wpackagist-plugin/regenerate-thumbnails":"^2.2.6",
    "wpackagist-plugin/simple-301-redirects":"^1.06",
    "wpackagist-plugin/wp-seo-acf-content-analysis":"^0.1"
  },
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web/wp"
  }
}


Another aspect of this bug - For a while it was only happening on our production server. As a test, we re-provisioned the staging server and the bug followed and started happening there. It may be that it’s not noticeable until you reprovision a server.

Deploys were successful on staging until we re-provisioned the staging server, and then they’ve failed after the reprovision.

I’m using Vagrant 1.8.1, virtualbox 5.0.15 r105127, ansible 2.0.0.2

Any ideas of what might be going on here?

For my failure, it’s happening with a first-time deployment to a new staging server on a new DO Droplet. Not a re-provisioning (which I dare not try on local Vagrant development just yet :relaxed:)

I should note that I was forced had to re-run ansible-galaxy install -r requirements.yml to make sure that vendor/roles was updated with new composer.

I’m using ansible 2.0.0.2. FWIW, two weeks ago, a test staging deployment was successful.

I’m running into the exact same issue. Fresh server, ‘staging’, and this is the initial deploy. Server provisioned without an issue.

TASK [deploy : Install Composer dependencies] **********************************
fatal: [54.175.19.151]: FAILED! => {"changed": true, "cmd": ["composer", "install", "--no-ansi", "--no-dev", "--no-interaction", "--no-progress", "--optimize-autoloader", "--no-scripts"], "delta": "0:00:06.594386", "end": "2016-02-24 13:20:11.745974", "failed": true, "rc": 1, "start": "2016-02-24 13:20:05.151588", "stderr": "Loading composer repositories with package information
Installing dependencies from lock file
- Installing composer/installers (v1.0.12) 
Downloading
Failed to download composer/installers from dist: Could not decompress the archive, enable the PHP zip extension.
The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini
Now trying to download from source
- Installing composer/installers (v1.0.12)
Cloning 4127333b03e8b4c08d081958548aae5419d1a2fa
 - Installing johnpbloch/wordpress-core-installer (0.2.1)
Downloading
Failed to download johnpbloch/wordpress-core-installer from dist: Could not decompress the archive, enable the PHP zip extension.
The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini
 Now trying to download from source
- Installing johnpbloch/wordpress-core-installer (0.2.1)   
Cloning a04c2c383ef13aae077f36799ed2eafdebd618d2
- Installing deliciousbrains/wp-migrate-db-pro (1.5.5)
Downloading
[RuntimeException]
Could not decompress the archive, enable the PHP zip extension.
The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini                                                                          Install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...", "stdout": "", "stdout_lines": [], "warnings": []}

The fix to this is to add php7.0-zip to your roles/php/tasks/main.yml

This goes under this area:

- name: Install PHP 7.0
  apt:
    name: "{{ item }}"
    state: present
    force: yes
  with_items:
  - php7.0-cli
  - php7.0-common
  - php7.0-curl
  - php7.0-dev
  - php7.0-fpm
  - php7.0-gd
  - php7.0-mcrypt
  - php7.0-mysql
  - php7.0-opcache
6 Likes

@brandon Looks like that did the trick! I also added in php7.0-xml & php7.0-xmlrpc for good measure since that looks like it is looming (and this site uses Jetpack).

Now I just have to get WP Migrate DB Pro working :smirk:

Much thanks to you and all the other discoursers and contributors.

Works like a charm! And makes sense. Time for me to learn Ansible better.

Many thanks, @brandon and everyone!

@brandon Nice one! I was pulling my hair out last night, thinking I had done something wrong.
Thanks so much

Thanks to @brandon this has been fixed in Trellis. See https://github.com/roots/trellis/pull/503

Friendly reminder: do not manually install these packages. Update Trellis and then re-provision your server :thumbsup:

4 Likes
sudo apt-get install subversion

This was solution for me.

1 Like