以前、 phpenvでPHP7系ビルド時のエラーに関する対処法まとめ という記事を書きましたがそれのPHP8版です

環境

  • anyenv, phpenv使用
  • php 8.1.29
  • Debian 12 bookworm on WSLg

急いでいる人向け

この記事に書いてあるパッケージの一括インストール

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
sudo apt install -y build-essential \
pkg-config \
libxml2-dev \
libssl-dev \
libsqlite3-dev \
zlib1g-dev \
libcurl4-openssl-dev \
libpng-dev \
libjpeg-dev \
libonig-dev \
libreadline-dev \
libtidy-dev \
libxslt-dev \
libzip-dev \
autoconf \
build-essential \
pkg-config \
libxml2-dev \
libssl-dev \
libsqlite3-dev \
zlib1g-dev \
libcurl4-openssl-dev \
libpng-dev \
libjpeg-dev \
libonig-dev \
libreadline-dev \
libtidy-dev \
libxslt-dev \
libzip-dev \
autoconf

エラー: tar (child): bzip2: exec 不能: そのようなファイルやディレクトリはありません

1
sudo apt install build-essential

エラー: configure: error: The pkg-config script could not be found or is too old. Make sure it

1
sudo apt install pkg-config

エラー: configure: error: Package requirements (libxml-2.0 >= 2.9.0) were not met:

1
sudo apt install libxml2-dev

エラー: configure: error: Package requirements (openssl >= 1.0.2) were not met:

1
sudo apt install libssl-dev

エラー: configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:

1
sudo apt install libsqlite3-dev

エラー: configure: error: Package requirements (zlib >= 1.2.0.4) were not met:

1
sudo apt install zlib1g-dev

エラー: configure: error: Package requirements (libcurl >= 7.29.0) were not met:

1
sudo apt install libcurl4-openssl-dev

エラー: configure: error: Package requirements (libpng) were not met:

1
sudo apt install libpng-dev

エラー: configure: error: Package requirements (libjpeg) were not met:

1
sudo apt install libjpeg-dev

エラー: configure: error: Package requirements (oniguruma) were not met:

1
sudo apt install libonig-dev

エラー: configure: error: Please reinstall readline - I cannot find readline.h

1
sudo apt install libreadline-dev

エラー: configure: error: Cannot find libtidy

1
sudo apt install libtidy-dev

エラー: configure: error: Package requirements (libxslt >= 1.1.0) were not met:

1
sudo apt install libxslt-dev

エラー: Package 'libzip', required by 'virtual:world', not found

1
sudo apt install libzip-dev

エラー: PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.

1
sudo apt install autoconf