# How to install the GD PHP extension

# Why use the GD PHP extension?

By default, the Ymir runtime comes with the Imagick PHP extension (opens new window) for image processing. In contrast to the GD extension (opens new window), the Imagick extension has more features and capabilities. This is why Ymir uses it as its image processing extension.

However, there are some plugins that only support the GD extension. For that reason, you'll need to install the GD extension in your project.

# Requirements

To install the GD extension in your Ymir project, you'll need to:

# Configuring your Ymir project to install the GD extension

Once your project satisfies the above requirements, you'll need to replace your project's Dockerfile with the one below. Please note that <PHP_VERSION> is a placeholder. You should replace it with your desired PHP version. (e.g. 81 for PHP 8.1)

FROM --platform=linux/x86_64 ymirapp/php-runtime:php-<PHP_VERSION>

ENTRYPOINT []

CMD ["/bin/sh", "-c", "/opt/bootstrap"]

RUN LD_LIBRARY_PATH= yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN LD_LIBRARY_PATH= yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN LD_LIBRARY_PATH= yum install -y yum-utils
RUN LD_LIBRARY_PATH= yum-config-manager --enable remi-php<PHP_VERSION>
RUN LD_LIBRARY_PATH= yum install -y php<PHP_VERSION>-php-gd

RUN echo "extension=/opt/remi/php<PHP_VERSION>/root/usr/lib64/php/modules/gd.so" >> /opt/ymir/etc/php/conf.d/php.ini

COPY runtime/src /opt/src

COPY . /var/task