Can't Install ext-zip package on CircleCI 2.0

We’ve had 2 people spend hours on this. We can not figure out how to get the package ext-zip installed and working properly.

Running these commands gets it installed.

sudo apt-get install libzip-dev
sudo apt-get install zip

But PHP does not see it.

#!/bin/bash -eo pipefail
composer install -n --prefer-dist
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - facebook/webdriver 1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - facebook/webdriver 1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for facebook/webdriver 1.4.1 -> satisfiable by facebook/webdriver[1.4.1].

Exited with code 2

This is my configuration file

# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
  build:
    docker:
      - image: circleci/php:7.0.23-browsers
    working_directory: ~/laravel
    steps:
      - checkout
      - run: sudo apt install -y libsqlite3-dev
      - run: composer self-update
      - restore_cache:
          keys:
            - composer-v1-{{ checksum "composer.json" }}
            - composer-v1-
      - run: composer install -n --prefer-dist
      - save_cache:
          key: composer-v1-{{ checksum "composer.json" }}
          paths:
            - vendor
      - run: touch database/database.sqlite
      - run: php artisan migrate --env=testing --force
      - run: php vendor/bin/phpunit

      - run: sudo apt-get install -y libsqlite3-dev
      - run: cp .env.testing .env
      - run: composer install -n --ignore-platform-reqs
      - run: npm install
      - run: npm run production
      - run: vendor/bin/phpunit

After many hours I got it to work by adding the following run commands to the config.yml circleCI file.


      - run:
         name: Install PHP libzip-dev
         command: sudo apt-get install -y libzip-dev

      - run:
         name: Install PHP zip
         command: sudo docker-php-ext-install zip

2 Likes

This was my complete setup for CircleCI 2.0, with Laravel 5.5 and Laravel Dusk, using PHP 7.0.

Thaks a lot for this !!

Thanks for this!

Thanks a lot for this! It saved me hours of trial and error!

I’m confused by this. The packages you mentioned (libzip-dev and zip) are GNU/Linux dependencies, and as far as I know won’t satisfy PHP dependencies at all. You’d be looking for php-zip or php7.0-zip, at least on Ubuntu-flavoured distros.

Have I maybe just read your post wrongly? :blush: