1
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?

More than 1 year has passed since last update.

Amazon Linux 2 に PHP8.2 をインストールする時にハマった件(libgd.so.103)

Posted at

Amazon Linux 2 に PHP8.2 をインストールする時にハマった件(libgd.so.103)

userdataの抜粋

EC2インスタンスのUserDataの保存場所としては、/var/lib/cloud/instance/scriptsに入っている

私の環境では、/var/lib/cloud/instance/scripts/runcmd

中身を抜粋するとこの様な感じ

#!/bin/sh
amazon-linux-extras install -y epel
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum -y update
yum -y install git nfs-utils yum-utils
yum -y --enablerepo=remi install composer
yum -y remove php* php-* libzip* libsodium
yum -y install libzip5 libsodium krb5-devel openssl-devel gcc gcc-c++ libxml2-devel libtool oniguruma5php jbigkit gd gd-devel libwmf libraqm gd3php
yum -y --disablerepo=* --enablerepo=remi-php82 install php php-{cli,fpm,zip,devel,gd,mbstring,curl,xml,pear,bcmath,mysqlnd}

結論から言うと
 gd3phpがインストールされていないと、php-gdが依存関係でインストールできませんでした。

この様なエラーが出る

エラー: パッケージ: php-gd-8.2.4-1.el7.remi.x86_64 (remi-php82)
       要求: libgd.so.103()(64bit)

今回の記事のキモは、どうやって、gd3phpまで辿りつけたかです。

libgdって事で、なんとなくgd系のものが足りないとはわかるが・・・

1. ldconfigコマンドで共有ライブラリのリンクを調べます。

ldconfig -p

libgd.so.2 (libc6,x86-64) => /lib64/libgd.so.2
libgd.so (libc6,x86-64) => /lib64/libgd.so

確かにlibgd.so.103が無い・・・
ピンポイントで103がインストールされないとダメらしい

libgd.so.103で、ググるとgd3php-2.3.3-7.el7.remi.x86_64 ...がヒットする

2. yum info gd3phpしてみると、インストールされていなかった

php82に絞りたかったので、--disablerepo=* --enablerepo=remi-php82としていた

remi-php82に絞らないと、yum install php82 php82-php-*と指定する必要があり
そうすると、/usr/bin/php82になってしまって、alternativesでパス通さないといけなくなるので、リポジトリを絞っていました。

3. gd3phpは、remiリポジトリなので、phpの前にyumで入れておく

yum -y install libzip5 libsodium krb5-devel openssl-devel gcc gcc-c++ libxml2-devel libtool oniguruma5php jbigkit gd gd-devel libwmf libraqm gd3php
ls -la libgd.so.103.0.11
-rwxr-xr-x 1 root root 420624  6月 23  2022 libgd.so.103.0.11

入った!

おしまい

1
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
1
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?