Installing PHP Extensions?

Hi!

Is it possible to install php extensions within a whole pipeline?

- name: Install PHP Extensions
  image: alpine
  commands:
  - apk add php-pdo_mysql php-pdo_pgsql php php-gd --no-cache

Works, however only during this step as the files are not shared

And when executing this inside a PHP image, it obviously does not have the alpine environment so that wont work either.

I ended up using the php alpine package, sadly its merged into one step but at least it works

- name: Migrate and Run Tests
  image: php:7.4-alpine
  commands:
  - apk --no-cache add libpq autoconf gcc libc-dev make postgresql-dev postgresql-libs
  - pecl install redis-5.3.2
  - docker-php-ext-install pgsql pdo_pgsql pdo_mysql
  - docker-php-ext-enable pdo_pgsql pdo_mysql redis
  - php bin/cli.php migrate

Hi Justin,
The solution that’s working looks fine, do let us know if you still need any help from us.

Regards,
Harness Support

You may wish to build an image that has your dependencies baked in, as 1. installing on each build takes time that is duplicated and could be saved, and 2. by installing on each build, your builds could end up with different libraries in case upstream changes versions between builds.