Recently we’re getting the following error in our recent builds. AFAIK nothing has changed in our config so we’re not sure why it is being caused all of a sudden and how it can be resolved?
When it is installing the php packages the error shows up at the end…
Seems like a recent update in the CircleCI PHP Docker images broke something. The PHP_INI_DIR environment variable that’s normally set by the docker/php image that CircleCI’s image pulls from isn’t being set correctly.
Here’s an example of a CircleCI config that fails:
version: 2
jobs:
build:
docker:
- image: circleci/php:7.2.12-cli-stretch@sha256:135094d5fbcaf2c511d18dc9999349a1579cf0df12663a05daf92c7552eb3a90
working_directory: ~/repo
steps:
- checkout
- run: sudo apt-get install -y libgmp-dev libgd-dev
- run: sudo docker-php-ext-configure gd --with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-zlib-dir=/usr
- run: sudo docker-php-ext-install -j$(nproc) bcmath exif gd gmp pdo_mysql
- run: sudo pecl install apcu-5.1.12 && sudo docker-php-ext-enable apcu
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: composer install -n --prefer-dist
- save_cache:
paths:
- ./vendor
key: v1-dependencies-{{ checksum "composer.json" }}
# run tests!
- run: composer test
One fix to this, albeit temporary, was to add a -E in the command. Like this
command: sudo -E docker-php-ext-install zip intl sodium pcntl bcmath
According to the man page this does this:
Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the user does not have permission to preserve the environment.