0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PHPのアプリケーションコンテナに入ってGDをインストールする方法

Posted at

ローカル環境で帳票を出力しようしたときに、GDが入っていないエラーで怒られたのでGDをインストールするコマンドを忘備録として記事化しました。

The PHP GD extension is required, but is not installed. in /application/vendor/dompdf/dompdf/lib/Cpdf.php:5825

手順は以下の通りです。

1. コンテナに入る

docker exec -it <コンテナid> /bin/sh

2. パッケージリストの更新と必要なパッケージのインストール

apk update && apk add --no-cache \
    freetype-dev \
    jpeg-dev \
    libpng-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install gd

3. サービスの再起動(必要に応じて)

service nginx restart       # または systemctl restart nginx
service php-fpm restart     # または systemctl restart php-fpm

上記の手順により、PHP GD拡張がインストールされ、有効にすることができます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?