From dfeccdd3374e80bd76a8e443e4ec7a68d6b815ce Mon Sep 17 00:00:00 2001 From: Carl Alexander Date: Wed, 7 Feb 2024 14:12:52 -0700 Subject: [PATCH] add gd extension guide --- docs/.vuepress/config.js | 1 + docs/guides/gd-extension.md | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 docs/guides/gd-extension.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 76d6e7c..7f3e23e 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -74,6 +74,7 @@ module.exports = { '/guides/object-cache', '/guides/cloudflare', '/guides/new-relic', + '/guides/gd-extension', ] }, { diff --git a/docs/guides/gd-extension.md b/docs/guides/gd-extension.md new file mode 100644 index 0000000..6d8f25e --- /dev/null +++ b/docs/guides/gd-extension.md @@ -0,0 +1,45 @@ +# How to install the GD PHP extension + +[[toc]] + +## Why use the GD PHP extension? + +By default, the Ymir runtime comes with the [Imagick PHP extension][1] for image processing. In contrast to the [GD extension][2], 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: + + * Use [container image deployment][3] + * Use `x86_64` as your [`architecture`][4] + +## 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 `` is a placeholder. You should replace it with your desired PHP version. (e.g. `81` for PHP 8.1) + +```docker +FROM --platform=linux/x86_64 ymirapp/php-runtime:php- + +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 +RUN LD_LIBRARY_PATH= yum install -y php-php-gd + +RUN echo "extension=/opt/remi/php/root/usr/lib64/php/modules/gd.so" >> /opt/ymir/etc/php/conf.d/php.ini + +COPY runtime/src /opt/src + +COPY . /var/task +``` + +[1]: https://www.php.net/manual/en/book.imagick.php +[2]: https://www.php.net/manual/en/book.image.php +[3]: ./container-image-deployment.md +[4]: ../reference/configuration.md#architecture \ No newline at end of file