Cannot create /conf.d/docker-php-ext-pcntl.ini: Directory nonexistent

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…

Pastbin: https://pastebin.com/n7jt7Bdq

1 Like

Readers will probably need to see your config, to see how you are kicking off that extension build.

Also, can you not load a pcntl extension from your upstream distribution repo, rather than compiling it?

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

Here’s the config:

# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 3
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/php:7.2-cli
      
      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/mysql:9.4

    working_directory: ~/repo

    steps:
      - checkout

      # 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: sudo apt-get update && sudo apt-get install -y libsodium-dev zip
      - run:
          name: Install PHP packages
          command: sudo docker-php-ext-install zip intl sodium pcntl bcmath
      - run: composer install -n --prefer-dist
      - run: composer dump-autoload

      - save_cache:
          paths:
            - ./vendor
          key: v1-dependencies-{{ checksum "composer.json" }}

      # prepare the database
      - run: cp .env.example .env
      - run: php artisan key:generate
#      - run: php artisan migrate --seed
      # clear app and config cache
      - run: php artisan cache:clear
      - run: php artisan config:clear

      # run tests!
      - run: vendor/bin/phpunit --exclude-group=binbase
      - run: vendor/bin/phpunit tests/Integration/

  deploy:
    docker:
      # specify the version you desire here
      - image: circleci/php:7.2-cli
    steps:
      - checkout
      - run: composer install -n --prefer-dist
      - run:
          name: Deploy using Deployer
          command: vendor/bin/dep deploy production

workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build
      # - deploy:
      #     requires:
      #       - build
      #     filters:
      #       branches:
      #         only: master

Hello,

The following steps also fails:

run: sudo docker-php-ext-install zip pcntl pdo_mysql gmp bcmath

With the following error:

Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20160303/
/usr/local/bin/docker-php-ext-enable: 108: /usr/local/bin/docker-php-ext-enable: cannot create /conf.d/docker-php-ext-pcntl.ini: Directory nonexistent
Exited with code 123

I’m using the circleci/php:7.1-browsers image.

This only started happening 2 weeks ago.

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.