PHP 7.2 GD Image with jpeg support



I’m having a heck of a time getting gd image support in PHP images. Ive successfully gotten support for png images but not jpeg. I still get gd/imagejpeg() is not defined.
my .yml file is below

 # PHP CircleCI 2.0 configuration file
 # Check for more details
 version: 2
      # specify the version you desire here
      - image: circleci/php:7.2-cli

    working_directory: ~/repo

      - run: sudo apt-get update && sudo apt-get install -y libpng-dev libjpeg62-turbo-
      - run:
          name: Install PHP Extensions
          command: sudo docker-php-ext-install gd exif

      - checkout

      # Download and cache dependencies
      - restore_cache:
          - 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:
            - ./vendor
          key: v1-dependencies-{{ checksum "composer.json" }}

      # run tests!
      - run: vendor/bin/phpunit ./tests --exclude-group missing-env


I’m not familiar with the docker-php-ext-install command. Could you just do it through the Ubuntu repo?

sudo apt-get install -y php-gd

I am assuming circleci/php:7.2-cli is based on Ubuntu here, of course.

I’d also suggest looking at the installations of PHP in this image. I speculate that the default repo version of PHP is 7.1, and 7.2 has been custom-compiled from scratch by CircleCI builders. If that is correct, modules would need to be installed in a non-default place. Get an SSH session on this running container, and search for PHP installations.


Our images are based on the upstream Docker Library Official images. For PHP & GD, the official instructions has an example. Go here and scroll down to the “PHP Core Extensions” section.

I would link directly but it seems like I can’t. :confused:


Thanks so much @FelicianoTech that was exactly the pointer i needed.

closed #5