以下のコマンドを実行してAmazon Linux 2023にPHPをインストールしました。
[root@ip-***-***-***-*** ~]# dnf install php
2026年2月11日現在では、PHP8.5がインストール可能でした。
実際にコマンドを実行した結果は以下です。

[root@ip-***-***-***-*** ~]# dnf install php
Last metadata expiration check: 0:46:42 ago on Wed Feb 11 09:38:22 2026.
Dependencies resolved.
==================================================================================================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================================================================================================
Installing:
php8.5 x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 15 k
Installing dependencies:
apr x86_64 1.7.5-1.amzn2023.0.4 amazonlinux 129 k
apr-util x86_64 1.6.3-1.amzn2023.0.2 amazonlinux 97 k
apr-util-lmdb x86_64 1.6.3-1.amzn2023.0.2 amazonlinux 13 k
httpd-core x86_64 2.4.66-1.amzn2023.0.1 amazonlinux 1.4 M
httpd-filesystem noarch 2.4.66-1.amzn2023.0.1 amazonlinux 13 k
httpd-tools x86_64 2.4.66-1.amzn2023.0.1 amazonlinux 81 k
libbrotli x86_64 1.0.9-4.amzn2023.0.2 amazonlinux 315 k
libsodium x86_64 1.0.19-4.amzn2023 amazonlinux 176 k
libxslt x86_64 1.1.43-1.amzn2023.0.3 amazonlinux 183 k
mailcap noarch 2.1.49-3.amzn2023.0.3 amazonlinux 33 k
php8.5-cli x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 6.0 M
php8.5-common x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 853 k
php8.5-process x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 50 k
php8.5-xml x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 248 k
Installing weak dependencies:
apr-util-openssl x86_64 1.6.3-1.amzn2023.0.2 amazonlinux 15 k
httpd x86_64 2.4.66-1.amzn2023.0.1 amazonlinux 47 k
mod_http2 x86_64 2.0.27-1.amzn2023.0.3 amazonlinux 166 k
mod_lua x86_64 2.4.66-1.amzn2023.0.1 amazonlinux 60 k
php8.5-fpm x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 3.0 M
php8.5-mbstring x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 540 k
php8.5-pdo x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 101 k
php8.5-sodium x86_64 8.5.1-1.amzn2023.0.1 amazonlinux 46 k
Transaction Summary
==================================================================================================================================================================================================
Install 23 Packages
Total download size: 14 M
Installed size: 66 M
Is this ok [y/N]: y
Downloading Packages:
(1/23): apr-util-1.6.3-1.amzn2023.0.2.x86_64.rpm 2.5 MB/s | 97 kB 00:00
(2/23): apr-util-lmdb-1.6.3-1.amzn2023.0.2.x86_64.rpm 324 kB/s | 13 kB 00:00
(3/23): apr-1.7.5-1.amzn2023.0.4.x86_64.rpm 2.6 MB/s | 129 kB 00:00
(4/23): apr-util-openssl-1.6.3-1.amzn2023.0.2.x86_64.rpm 629 kB/s | 15 kB 00:00
(5/23): httpd-2.4.66-1.amzn2023.0.1.x86_64.rpm 1.8 MB/s | 47 kB 00:00
(6/23): httpd-core-2.4.66-1.amzn2023.0.1.x86_64.rpm 44 MB/s | 1.4 MB 00:00
(7/23): httpd-filesystem-2.4.66-1.amzn2023.0.1.noarch.rpm 541 kB/s | 13 kB 00:00
(8/23): httpd-tools-2.4.66-1.amzn2023.0.1.x86_64.rpm 2.9 MB/s | 81 kB 00:00
(9/23): libbrotli-1.0.9-4.amzn2023.0.2.x86_64.rpm 11 MB/s | 315 kB 00:00
(10/23): libsodium-1.0.19-4.amzn2023.x86_64.rpm 6.6 MB/s | 176 kB 00:00
(11/23): libxslt-1.1.43-1.amzn2023.0.3.x86_64.rpm 7.3 MB/s | 183 kB 00:00
(12/23): mailcap-2.1.49-3.amzn2023.0.3.noarch.rpm 1.2 MB/s | 33 kB 00:00
(13/23): mod_http2-2.0.27-1.amzn2023.0.3.x86_64.rpm 6.1 MB/s | 166 kB 00:00
(14/23): mod_lua-2.4.66-1.amzn2023.0.1.x86_64.rpm 2.3 MB/s | 60 kB 00:00
(15/23): php8.5-8.5.1-1.amzn2023.0.1.x86_64.rpm 537 kB/s | 15 kB 00:00
(16/23): php8.5-common-8.5.1-1.amzn2023.0.1.x86_64.rpm 9.7 MB/s | 853 kB 00:00
(17/23): php8.5-cli-8.5.1-1.amzn2023.0.1.x86_64.rpm 46 MB/s | 6.0 MB 00:00
(18/23): php8.5-fpm-8.5.1-1.amzn2023.0.1.x86_64.rpm 24 MB/s | 3.0 MB 00:00
(19/23): php8.5-pdo-8.5.1-1.amzn2023.0.1.x86_64.rpm 3.0 MB/s | 101 kB 00:00
(20/23): php8.5-mbstring-8.5.1-1.amzn2023.0.1.x86_64.rpm 6.4 MB/s | 540 kB 00:00
(21/23): php8.5-process-8.5.1-1.amzn2023.0.1.x86_64.rpm 1.8 MB/s | 50 kB 00:00
(22/23): php8.5-sodium-8.5.1-1.amzn2023.0.1.x86_64.rpm 979 kB/s | 46 kB 00:00
(23/23): php8.5-xml-8.5.1-1.amzn2023.0.1.x86_64.rpm 5.2 MB/s | 248 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 33 MB/s | 14 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php8.5-common-8.5.1-1.amzn2023.0.1.x86_64 1/23
Installing : apr-1.7.5-1.amzn2023.0.4.x86_64 2/23
Installing : apr-util-lmdb-1.6.3-1.amzn2023.0.2.x86_64 3/23
Installing : apr-util-openssl-1.6.3-1.amzn2023.0.2.x86_64 4/23
Installing : apr-util-1.6.3-1.amzn2023.0.2.x86_64 5/23
Installing : mailcap-2.1.49-3.amzn2023.0.3.noarch 6/23
Running scriptlet: httpd-filesystem-2.4.66-1.amzn2023.0.1.noarch 7/23
Installing : httpd-filesystem-2.4.66-1.amzn2023.0.1.noarch 7/23
Installing : php8.5-fpm-8.5.1-1.amzn2023.0.1.x86_64 8/23
Running scriptlet: php8.5-fpm-8.5.1-1.amzn2023.0.1.x86_64 8/23
Installing : httpd-tools-2.4.66-1.amzn2023.0.1.x86_64 9/23
Installing : httpd-core-2.4.66-1.amzn2023.0.1.x86_64 10/23
Installing : mod_http2-2.0.27-1.amzn2023.0.3.x86_64 11/23
Installing : mod_lua-2.4.66-1.amzn2023.0.1.x86_64 12/23
Installing : php8.5-cli-8.5.1-1.amzn2023.0.1.x86_64 13/23
Installing : php8.5-mbstring-8.5.1-1.amzn2023.0.1.x86_64 14/23
Installing : php8.5-pdo-8.5.1-1.amzn2023.0.1.x86_64 15/23
Installing : php8.5-process-8.5.1-1.amzn2023.0.1.x86_64 16/23
Installing : libxslt-1.1.43-1.amzn2023.0.3.x86_64 17/23
Installing : php8.5-xml-8.5.1-1.amzn2023.0.1.x86_64 18/23
Installing : libsodium-1.0.19-4.amzn2023.x86_64 19/23
Installing : php8.5-sodium-8.5.1-1.amzn2023.0.1.x86_64 20/23
Installing : libbrotli-1.0.9-4.amzn2023.0.2.x86_64 21/23
Installing : httpd-2.4.66-1.amzn2023.0.1.x86_64 22/23
Running scriptlet: httpd-2.4.66-1.amzn2023.0.1.x86_64 22/23
Installing : php8.5-8.5.1-1.amzn2023.0.1.x86_64 23/23
Running scriptlet: httpd-2.4.66-1.amzn2023.0.1.x86_64 23/23
Running scriptlet: php8.5-8.5.1-1.amzn2023.0.1.x86_64 23/23
Verifying : apr-1.7.5-1.amzn2023.0.4.x86_64 1/23
Verifying : apr-util-1.6.3-1.amzn2023.0.2.x86_64 2/23
Verifying : apr-util-lmdb-1.6.3-1.amzn2023.0.2.x86_64 3/23
Verifying : apr-util-openssl-1.6.3-1.amzn2023.0.2.x86_64 4/23
Verifying : httpd-2.4.66-1.amzn2023.0.1.x86_64 5/23
Verifying : httpd-core-2.4.66-1.amzn2023.0.1.x86_64 6/23
Verifying : httpd-filesystem-2.4.66-1.amzn2023.0.1.noarch 7/23
Verifying : httpd-tools-2.4.66-1.amzn2023.0.1.x86_64 8/23
Verifying : libbrotli-1.0.9-4.amzn2023.0.2.x86_64 9/23
Verifying : libsodium-1.0.19-4.amzn2023.x86_64 10/23
Verifying : libxslt-1.1.43-1.amzn2023.0.3.x86_64 11/23
Verifying : mailcap-2.1.49-3.amzn2023.0.3.noarch 12/23
Verifying : mod_http2-2.0.27-1.amzn2023.0.3.x86_64 13/23
Verifying : mod_lua-2.4.66-1.amzn2023.0.1.x86_64 14/23
Verifying : php8.5-8.5.1-1.amzn2023.0.1.x86_64 15/23
Verifying : php8.5-cli-8.5.1-1.amzn2023.0.1.x86_64 16/23
Verifying : php8.5-common-8.5.1-1.amzn2023.0.1.x86_64 17/23
Verifying : php8.5-fpm-8.5.1-1.amzn2023.0.1.x86_64 18/23
Verifying : php8.5-mbstring-8.5.1-1.amzn2023.0.1.x86_64 19/23
Verifying : php8.5-pdo-8.5.1-1.amzn2023.0.1.x86_64 20/23
Verifying : php8.5-process-8.5.1-1.amzn2023.0.1.x86_64 21/23
Verifying : php8.5-sodium-8.5.1-1.amzn2023.0.1.x86_64 22/23
Verifying : php8.5-xml-8.5.1-1.amzn2023.0.1.x86_64 23/23
Installed:
apr-1.7.5-1.amzn2023.0.4.x86_64 apr-util-1.6.3-1.amzn2023.0.2.x86_64 apr-util-lmdb-1.6.3-1.amzn2023.0.2.x86_64 apr-util-openssl-1.6.3-1.amzn2023.0.2.x86_64
httpd-2.4.66-1.amzn2023.0.1.x86_64 httpd-core-2.4.66-1.amzn2023.0.1.x86_64 httpd-filesystem-2.4.66-1.amzn2023.0.1.noarch httpd-tools-2.4.66-1.amzn2023.0.1.x86_64
libbrotli-1.0.9-4.amzn2023.0.2.x86_64 libsodium-1.0.19-4.amzn2023.x86_64 libxslt-1.1.43-1.amzn2023.0.3.x86_64 mailcap-2.1.49-3.amzn2023.0.3.noarch
mod_http2-2.0.27-1.amzn2023.0.3.x86_64 mod_lua-2.4.66-1.amzn2023.0.1.x86_64 php8.5-8.5.1-1.amzn2023.0.1.x86_64 php8.5-cli-8.5.1-1.amzn2023.0.1.x86_64
php8.5-common-8.5.1-1.amzn2023.0.1.x86_64 php8.5-fpm-8.5.1-1.amzn2023.0.1.x86_64 php8.5-mbstring-8.5.1-1.amzn2023.0.1.x86_64 php8.5-pdo-8.5.1-1.amzn2023.0.1.x86_64
php8.5-process-8.5.1-1.amzn2023.0.1.x86_64 php8.5-sodium-8.5.1-1.amzn2023.0.1.x86_64 php8.5-xml-8.5.1-1.amzn2023.0.1.x86_64
Complete!

