trixie(Debian13)の標準リポジトリから、PHP8.4をインストールします。前のバージョンのbookworm(Debian12)はPHP8.2です。
PHP8.4のインストール
下記のコマンドでPHP8.4をインストールします。

ほっぺ
busterの時代は、PHP7.4、bookwormにはPHP8.2が、そしてtrixieにはPHP8.4が入ってました。
$ sudo apt-get -y install php8.4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php8.2-common' for regex 'php8.2'
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
yamamomo@raspberrypi5:~ $ sudo apt-get -y install php8.3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php8.3-common' for regex 'php8.3'
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
yamamomo@raspberrypi5:~ $ sudo apt-get -y install php8.4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libapache2-mod-php8.4 libargon2-1 php-common php8.4-cli php8.4-common php8.4-opcache php8.4-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
libapache2-mod-php8.4 libargon2-1 php-common php8.4 php8.4-cli php8.4-common php8.4-opcache php8.4-readline
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,447 kB of archives.
After this operation, 24.1 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian trixie/main arm64 php-common all 2:96 [13.3 kB]
Get:2 http://deb.debian.org/debian trixie/main arm64 php8.4-common arm64 8.4.11-1 [734 kB]
Get:3 http://deb.debian.org/debian trixie/main arm64 php8.4-opcache arm64 8.4.11-1 [355 kB]
Get:4 http://deb.debian.org/debian trixie/main arm64 php8.4-readline arm64 8.4.11-1 [12.3 kB]
Get:5 http://deb.debian.org/debian trixie/main arm64 libargon2-1 arm64 0~20190702+dfsg-4+b2 [21.1 kB]
Get:6 http://deb.debian.org/debian trixie/main arm64 php8.4-cli arm64 8.4.11-1 [1,668 kB]
Get:7 http://deb.debian.org/debian trixie/main arm64 libapache2-mod-php8.4 arm64 8.4.11-1 [1,607 kB]
Get:8 http://deb.debian.org/debian trixie/main arm64 php8.4 all 8.4.11-1 [37.4 kB]
Fetched 4,447 kB in 0s (10.3 MB/s)
Selecting previously unselected package php-common.
(Reading database ... 69152 files and directories currently installed.)
Preparing to unpack .../0-php-common_2%3a96_all.deb ...
Unpacking php-common (2:96) ...
Selecting previously unselected package php8.4-common.
Preparing to unpack .../1-php8.4-common_8.4.11-1_arm64.deb ...
Unpacking php8.4-common (8.4.11-1) ...
Selecting previously unselected package php8.4-opcache.
Preparing to unpack .../2-php8.4-opcache_8.4.11-1_arm64.deb ...
Unpacking php8.4-opcache (8.4.11-1) ...
Selecting previously unselected package php8.4-readline.
Preparing to unpack .../3-php8.4-readline_8.4.11-1_arm64.deb ...
Unpacking php8.4-readline (8.4.11-1) ...
Selecting previously unselected package libargon2-1:arm64.
Preparing to unpack .../4-libargon2-1_0~20190702+dfsg-4+b2_arm64.deb ...
Unpacking libargon2-1:arm64 (0~20190702+dfsg-4+b2) ...
Selecting previously unselected package php8.4-cli.
Preparing to unpack .../5-php8.4-cli_8.4.11-1_arm64.deb ...
Unpacking php8.4-cli (8.4.11-1) ...
Selecting previously unselected package libapache2-mod-php8.4.
Preparing to unpack .../6-libapache2-mod-php8.4_8.4.11-1_arm64.deb ...
Unpacking libapache2-mod-php8.4 (8.4.11-1) ...
Selecting previously unselected package php8.4.
Preparing to unpack .../7-php8.4_8.4.11-1_all.deb ...
Unpacking php8.4 (8.4.11-1) ...
Setting up php-common (2:96) ...
Created symlink '/etc/systemd/system/timers.target.wants/phpsessionclean.timer' → '/usr/lib/systemd/system/phpsessionclean.timer'.
Setting up libargon2-1:arm64 (0~20190702+dfsg-4+b2) ...
Setting up php8.4-common (8.4.11-1) ...
Creating config file /etc/php/8.4/mods-available/calendar.ini with new version
Creating config file /etc/php/8.4/mods-available/ctype.ini with new version
Creating config file /etc/php/8.4/mods-available/exif.ini with new version
Creating config file /etc/php/8.4/mods-available/fileinfo.ini with new version
Creating config file /etc/php/8.4/mods-available/ffi.ini with new version
Creating config file /etc/php/8.4/mods-available/ftp.ini with new version
Creating config file /etc/php/8.4/mods-available/gettext.ini with new version
Creating config file /etc/php/8.4/mods-available/iconv.ini with new version
Creating config file /etc/php/8.4/mods-available/pdo.ini with new version
Creating config file /etc/php/8.4/mods-available/phar.ini with new version
Creating config file /etc/php/8.4/mods-available/posix.ini with new version
Creating config file /etc/php/8.4/mods-available/shmop.ini with new version
Creating config file /etc/php/8.4/mods-available/sockets.ini with new version
Creating config file /etc/php/8.4/mods-available/sysvmsg.ini with new version
Creating config file /etc/php/8.4/mods-available/sysvsem.ini with new version
Creating config file /etc/php/8.4/mods-available/sysvshm.ini with new version
Creating config file /etc/php/8.4/mods-available/tokenizer.ini with new version
Setting up php8.4-opcache (8.4.11-1) ...
Creating config file /etc/php/8.4/mods-available/opcache.ini with new version
Setting up php8.4-readline (8.4.11-1) ...
Creating config file /etc/php/8.4/mods-available/readline.ini with new version
Setting up php8.4-cli (8.4.11-1) ...
update-alternatives: using /usr/bin/php8.4 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar8.4 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar8.4 to provide /usr/bin/phar.phar (phar.phar) in auto mode
Creating config file /etc/php/8.4/cli/php.ini with new version
Setting up libapache2-mod-php8.4 (8.4.11-1) ...
Creating config file /etc/php/8.4/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php8.4
Setting up php8.4 (8.4.11-1) ...
Processing triggers for man-db (2.13.1-1) ...
Processing triggers for libc-bin (2.41-12+rpt1) ...
Processing triggers for php8.4-cli (8.4.11-1) ...
Processing triggers for libapache2-mod-php8.4 (8.4.11-1) ...
インストールされたPHPは
$ php -v
PHP 8.4.11 (cli) (built: Aug 3 2025 07:32:21) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.11, Copyright (c) Zend Technologies
with Zend OPcache v8.4.11, Copyright (c), by Zend Technologies
で確認できます。
PHPモジュールのインストール
WordPressに必要なモジュールをインストールします。
$ sudo apt-get -y install php8.4-curl php8.4-mbstring php8.4-mysql php8.4-imagick php8.4-xml php8.4-zip php8.4-intl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
fontconfig-config fonts-dejavu-core fonts-dejavu-mono fonts-droid-fallback fonts-noto-mono fonts-urw-base35 ghostscript imagemagick-7-common libaom3 libavahi-client3 libcups2t64 libdav1d7 libde265-0 libfftw3-double3 libfontconfig1
libfontenc1 libfreetype6 libgs-common libgs10 libgs10-common libheif-plugin-aomenc libheif-plugin-dav1d libheif-plugin-libde265 libheif-plugin-x265 libheif1 libice6 libidn12 libijs-0.35 libjbig2dec0 liblcms2-2 liblqr-1-0 libltdl7
libmagickcore-7.q16-10 libmagickwand-7.q16-10 libonig5 libopenjp2-7 libpaper-utils libpaper2 libraw23t64 libsm6 libwebpdemux2 libwebpmux3 libx265-215 libxslt1.1 libxt6t64 libzip5 poppler-data x11-common xfonts-encodings xfonts-utils
Suggested packages:
fonts-noto fonts-freefont-otf | fonts-freefont-ttf fonts-texgyre texlive-binaries cups-common libfftw3-bin libfftw3-dev libheif-plugin-ffmpegdec libheif-plugin-jpegdec libheif-plugin-jpegenc libheif-plugin-j2kdec
libheif-plugin-j2kenc libheif-plugin-kvazaar libheif-plugin-rav1e libheif-plugin-svtenc liblcms2-utils libmagickcore-7.q16-10-extra poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic
| fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum
The following NEW packages will be installed:
fontconfig-config fonts-dejavu-core fonts-dejavu-mono fonts-droid-fallback fonts-noto-mono fonts-urw-base35 ghostscript imagemagick-7-common libaom3 libavahi-client3 libcups2t64 libdav1d7 libde265-0 libfftw3-double3 libfontconfig1
libfontenc1 libfreetype6 libgs-common libgs10 libgs10-common libheif-plugin-aomenc libheif-plugin-dav1d libheif-plugin-libde265 libheif-plugin-x265 libheif1 libice6 libidn12 libijs-0.35 libjbig2dec0 liblcms2-2 liblqr-1-0 libltdl7
libmagickcore-7.q16-10 libmagickwand-7.q16-10 libonig5 libopenjp2-7 libpaper-utils libpaper2 libraw23t64 libsm6 libwebpdemux2 libwebpmux3 libx265-215 libxslt1.1 libxt6t64 libzip5 php8.4-curl php8.4-imagick php8.4-intl php8.4-mbstring
php8.4-mysql php8.4-xml php8.4-zip poppler-data x11-common xfonts-encodings xfonts-utils
0 upgraded, 57 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.8 MB of archives.
After this operation, 120 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian trixie/main arm64 libfftw3-double3 arm64 3.3.10-2+b1 [337 kB]
Get:2 http://deb.debian.org/debian trixie/main arm64 libfreetype6 arm64 2.13.3+dfsg-1 [422 kB]
Get:3 http://deb.debian.org/debian trixie/main arm64 fonts-dejavu-mono all 2.37-8 [489 kB]
Get:4 http://deb.debian.org/debian trixie/main arm64 fonts-dejavu-core all 2.37-8 [840 kB]
Get:5 http://deb.debian.org/debian trixie/main arm64 libfontenc1 arm64 1:1.1.8-1+b2 [22.5 kB]
Get:6 http://deb.debian.org/debian trixie/main arm64 x11-common all 1:7.7+24 [217 kB]
Get:7 http://deb.debian.org/debian trixie/main arm64 xfonts-encodings all 1:1.0.4-2.2 [577 kB]
Get:8 http://deb.debian.org/debian trixie/main arm64 xfonts-utils arm64 1:7.7+7 [89.3 kB]
Get:9 http://deb.debian.org/debian trixie/main arm64 fonts-urw-base35 all 20200910-8 [10.8 MB]
Get:10 http://deb.debian.org/debian trixie/main arm64 fontconfig-config arm64 2.15.0-2.3 [318 kB]
Get:11 http://deb.debian.org/debian trixie/main arm64 libfontconfig1 arm64 2.15.0-2.3 [387 kB]
Get:12 http://deb.debian.org/debian trixie/main arm64 libdav1d7 arm64 1.5.1-1 [252 kB]
Get:13 http://deb.debian.org/debian trixie/main arm64 libheif-plugin-dav1d arm64 1.19.8-1 [11.6 kB]
Get:14 http://deb.debian.org/debian trixie/main arm64 libde265-0 arm64 1.0.15-1+b3 [153 kB]
Get:15 http://deb.debian.org/debian trixie/main arm64 libheif-plugin-libde265 arm64 1.19.8-1 [15.1 kB]
Get:16 http://deb.debian.org/debian trixie/main arm64 libheif1 arm64 1.19.8-1 [442 kB]
Get:17 http://deb.debian.org/debian trixie/main arm64 liblcms2-2 arm64 2.16-2 [151 kB]
Get:18 http://deb.debian.org/debian trixie/main arm64 liblqr-1-0 arm64 0.4.2-2.1+b2 [27.0 kB]
Get:19 http://deb.debian.org/debian trixie/main arm64 libltdl7 arm64 2.5.4-4 [415 kB]
Get:20 http://deb.debian.org/debian trixie/main arm64 libopenjp2-7 arm64 2.5.3-2.1~deb13u1 [189 kB]
Get:21 http://deb.debian.org/debian trixie/main arm64 libraw23t64 arm64 0.21.4-2 [371 kB]
Get:22 http://deb.debian.org/debian trixie/main arm64 libwebpdemux2 arm64 1.5.0-0.1 [113 kB]
Get:23 http://deb.debian.org/debian trixie/main arm64 libwebpmux3 arm64 1.5.0-0.1 [125 kB]
Get:24 http://deb.debian.org/debian-security trixie-security/main arm64 imagemagick-7-common all 8:7.1.1.43+dfsg1-1+deb13u2 [68.9 kB]
Get:25 http://deb.debian.org/debian-security trixie-security/main arm64 libmagickcore-7.q16-10 arm64 8:7.1.1.43+dfsg1-1+deb13u2 [1,648 kB]
Get:26 http://deb.debian.org/debian-security trixie-security/main arm64 libmagickwand-7.q16-10 arm64 8:7.1.1.43+dfsg1-1+deb13u2 [269 kB]
Get:27 http://deb.debian.org/debian trixie/main arm64 php8.4-imagick arm64 3.8.0-2 [95.9 kB]
Get:28 http://deb.debian.org/debian trixie/main arm64 poppler-data all 0.4.12-1 [1,601 kB]
Get:29 http://deb.debian.org/debian trixie/main arm64 fonts-droid-fallback all 1:8.1.0r7-1~1.gbp36536b [1,807 kB]
Get:30 http://deb.debian.org/debian trixie/main arm64 fonts-noto-mono all 20201225-2 [398 kB]
Get:31 http://deb.debian.org/debian-security trixie-security/main arm64 libgs-common all 10.05.1~dfsg-1+deb13u1 [148 kB]
Get:32 http://deb.debian.org/debian-security trixie-security/main arm64 libgs10-common all 10.05.1~dfsg-1+deb13u1 [479 kB]
Get:33 http://deb.debian.org/debian trixie/main arm64 libavahi-client3 arm64 0.8-16 [46.7 kB]
Get:34 http://deb.debian.org/debian-security trixie-security/main arm64 libcups2t64 arm64 2.4.10-3+deb13u1 [236 kB]
Get:35 http://deb.debian.org/debian trixie/main arm64 libidn12 arm64 1.43-1 [47.2 kB]
Get:36 http://deb.debian.org/debian trixie/main arm64 libijs-0.35 arm64 0.35-15.2 [14.6 kB]
Get:37 http://deb.debian.org/debian trixie/main arm64 libjbig2dec0 arm64 0.20-1+b3 [60.1 kB]
Get:38 http://deb.debian.org/debian trixie/main arm64 libpaper2 arm64 2.2.5-0.3+b2 [16.6 kB]
Get:39 http://deb.debian.org/debian trixie/main arm64 libice6 arm64 2:1.1.1-1 [62.1 kB]
Get:40 http://deb.debian.org/debian trixie/main arm64 libsm6 arm64 2:1.2.6-1 [36.4 kB]
Get:41 http://deb.debian.org/debian trixie/main arm64 libxt6t64 arm64 1:1.2.1-1.2+b2 [173 kB]
Get:42 http://deb.debian.org/debian-security trixie-security/main arm64 libgs10 arm64 10.05.1~dfsg-1+deb13u1 [2,359 kB]
Get:43 http://deb.debian.org/debian-security trixie-security/main arm64 ghostscript arm64 10.05.1~dfsg-1+deb13u1 [50.5 kB]
Get:44 http://deb.debian.org/debian trixie/main arm64 libaom3 arm64 3.12.1-1 [1,670 kB]
Get:45 http://deb.debian.org/debian trixie/main arm64 libheif-plugin-aomenc arm64 1.19.8-1 [22.1 kB]
Get:46 http://deb.debian.org/debian trixie/main arm64 libx265-215 arm64 4.1-2 [1,857 kB]
Get:47 http://deb.debian.org/debian trixie/main arm64 libheif-plugin-x265 arm64 1.19.8-1 [20.5 kB]
Get:48 http://deb.debian.org/debian trixie/main arm64 libonig5 arm64 6.9.9-1+b1 [181 kB]
Get:49 http://deb.debian.org/debian trixie/main arm64 libpaper-utils arm64 2.2.5-0.3+b2 [16.4 kB]
Get:50 http://deb.debian.org/debian-security trixie-security/main arm64 libxslt1.1 arm64 1.1.35-1.2+deb13u2 [222 kB]
Get:51 http://deb.debian.org/debian trixie/main arm64 libzip5 arm64 1.11.3-2 [59.4 kB]
Get:52 http://deb.debian.org/debian trixie/main arm64 php8.4-curl arm64 8.4.11-1 [37.5 kB]
Get:53 http://deb.debian.org/debian trixie/main arm64 php8.4-intl arm64 8.4.11-1 [141 kB]
Get:54 http://deb.debian.org/debian trixie/main arm64 php8.4-mbstring arm64 8.4.11-1 [436 kB]
Get:55 http://deb.debian.org/debian trixie/main arm64 php8.4-mysql arm64 8.4.11-1 [111 kB]
Get:56 http://deb.debian.org/debian trixie/main arm64 php8.4-xml arm64 8.4.11-1 [652 kB]
Get:57 http://deb.debian.org/debian trixie/main arm64 php8.4-zip arm64 8.4.11-1 [26.5 kB]
Fetched 31.8 MB in 3s (11.1 MB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
Selecting previously unselected package libfftw3-double3:arm64.
(Reading database ... 69286 files and directories currently installed.)
Preparing to unpack .../00-libfftw3-double3_3.3.10-2+b1_arm64.deb ...
Unpacking libfftw3-double3:arm64 (3.3.10-2+b1) ...
Selecting previously unselected package libfreetype6:arm64.
Preparing to unpack .../01-libfreetype6_2.13.3+dfsg-1_arm64.deb ...
Unpacking libfreetype6:arm64 (2.13.3+dfsg-1) ...
Selecting previously unselected package fonts-dejavu-mono.
Preparing to unpack .../02-fonts-dejavu-mono_2.37-8_all.deb ...
Unpacking fonts-dejavu-mono (2.37-8) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../03-fonts-dejavu-core_2.37-8_all.deb ...
Unpacking fonts-dejavu-core (2.37-8) ...
Selecting previously unselected package libfontenc1:arm64.
Preparing to unpack .../04-libfontenc1_1%3a1.1.8-1+b2_arm64.deb ...
Unpacking libfontenc1:arm64 (1:1.1.8-1+b2) ...
Selecting previously unselected package x11-common.
Preparing to unpack .../05-x11-common_1%3a7.7+24_all.deb ...
Unpacking x11-common (1:7.7+24) ...
Selecting previously unselected package xfonts-encodings.
Preparing to unpack .../06-xfonts-encodings_1%3a1.0.4-2.2_all.deb ...
Unpacking xfonts-encodings (1:1.0.4-2.2) ...
Selecting previously unselected package xfonts-utils.
Preparing to unpack .../07-xfonts-utils_1%3a7.7+7_arm64.deb ...
・
・
・
Apache2向けにphp-fpmをインストール
FPM(FastCGI Process Manager)と言われるPHPのFastCGI実装をインストールします。

ほっぺ
要するにPHPを速く動作させます。
インストール時にApache2の設定も変更するので、先にApache2をインストールしておいてください。

ももぶろ
忘れないでね。
$ sudo apt-get install php8.4-fpm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
php-pear
The following NEW packages will be installed:
php8.4-fpm
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,680 kB of archives.
After this operation, 6,151 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian trixie/main arm64 php8.4-fpm arm64 8.4.11-1 [1,680 kB]
Fetched 1,680 kB in 0s (9,934 kB/s)
Selecting previously unselected package php8.4-fpm.
(Reading database ... 71277 files and directories currently installed.)
Preparing to unpack .../php8.4-fpm_8.4.11-1_arm64.deb ...
Unpacking php8.4-fpm (8.4.11-1) ...
Setting up php8.4-fpm (8.4.11-1) ...
Creating config file /etc/php/8.4/fpm/php.ini with new version
NOTICE: Not enabling PHP 8.4 FPM by default.
NOTICE: To enable PHP 8.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Created symlink '/etc/systemd/system/multi-user.target.wants/php8.4-fpm.service' → '/usr/lib/systemd/system/php8.4-fpm.service'.
Processing triggers for man-db (2.13.1-1) ...
Processing triggers for php8.4-fpm (8.4.11-1) ...
NOTICE: Not enabling PHP 8.4 FPM by default.
NOTICE: To enable PHP 8.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
PHPの設定
日本語処理と動画アップロードの設定をします。
この設定をしなくても、WordPressは正常に動きます。変更内容を確認して必要な方は設定をしてください。
$ sudo vi /etc/php/8.4/apache2/php.ini

ももぶろ
viの超簡単な使い方は、ここを見てね
ファイルの中に既に定義されている行のコメントを外したり、値を変えたりします。
・
・ 手前省略
・
;extension=gmp
;extension=intl
;extension=imap
extension=mbstring <=行頭の;を削除して有効化
;extension=exif ; Must be after mbstring as it depends on it
;extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
・
・ 省略
・
[mbstring]
; language for internal character representation.
; This affects mb_send_mail() and mbstring.detect_order.
; http://php.net/mbstring.language
mbstring.language = Japanese <=行頭の;を削除して有効化
・
・ 以降省略
・
memory_limit = 128M
post_max_size = 40M
upload_max_filesize = 40M
動画は最大40MBまでアップロードできるようにします。
もっと大きなファイルをアップロードする場合は値を変更してください。
Apache2の再起動
PHP.iniを変更したので、Apache2を再起動します。
$ sudo systemctl restart apache2.service

ももぶろ
PHPのインストールはこれで終わりです。

