Installing PHP Extensions


#1

I have a PHP action which I’m trying to use to run a PHPUnit test suite for a Laravel application. One of my application dependencies requires the php-gd extension which throws the following error on composer install:

  • dompdf/dompdf v0.8.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.

I’ve tried running apt-get install php7.0-gd in the environment set up but I get the following error:

Reading package lists…
Building dependency tree…
Reading state information…
E: Unable to locate package php7.0-gd
E: Couldn’t find any package by regex ‘php7.0-gd’

How can I add a PHP extension to the pipeline? Thanks in advance for any help


#2

Hey there,
Try the following:

apt-get install -y libpng-dev
docker-php-ext-install gd

#3

Hi @Kivlov

Thanks very much for your reply, that command has fixed that issue but I’ve run into another issue now on php artisan migrate:

In PDOConnection.php line 47:

could not find driver

Looking around on Google it looks like this might be some db configuration issue, maybe to do with sql. I’ve tried adding the php-pdo extension with

docker-php-ext-install pdo

Which doesn’t seem to fix it. Some resources online are saying to install the php-myql package which I thought I could do with

docker-php-ext-install mysql

But there seems to be no such package. I also have MySQL set up in the Services section of the pipeline which I thought should cover this? Any pointers on what I could do?


#4

Hey there,
These are the packages that you should install:

docker-php-ext-install pdo pdo_mysql

This should do the trick.