2020-03-04に投稿

DockerでXdebugのインストールを失敗した場合

DockerのコンテナにXdebugをインストールしようとして失敗した。
発生したエラーは以下の2点。

  • autoconfがインストールされていなかった
  • Cコンパイラがインストールされていなかった

実行環境

その1 autoconfがインストールされていない

以下のようなエラーが表示された場合はautoconfがインストールされていない。

downloading xdebug-2.9.2.tgz ...
Starting to download xdebug-2.9.2.tgz (242,959 bytes)
..................................................done: 242,959 bytes
90 source files, building
running: phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

この場合はapk add autoconfを実行してインストールすればよい。

その2 コンパイラがインストールされていない

以下のようなエラーが表示された場合はコンパイラのインストールがされていない。

downloading xdebug-2.9.2.tgz ...
Starting to download xdebug-2.9.2.tgz (242,959 bytes)
..................................................done: 242,959 bytes
90 source files, building
running: phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
building in /tmp/pear/temp/pear-build-defaultuserhmhpmF/xdebug-2.9.2
running: /tmp/pear/temp/xdebug/configure --with-php-config=/usr/local/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... no
checking for cc... no
checking for gcc... no
configure: error: in `/tmp/pear/temp/pear-build-defaultuserhmhpmF/xdebug-2.9.2':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
ERROR: `/tmp/pear/temp/xdebug/configure --with-php-config=/usr/local/bin/php-config' failed

この場合はapk add gcc g++ makeを実行してインストールすればコンパイルが可能になる。

また、apk add build-baseの実行でも必要なパッケージのインストールが行える。
build-baseは以下7つのパッケージをインストールする。

  • binutils
  • file
  • fortify-headers
  • g++
  • gcc
  • libc-dev
  • make

参考

Originally published at choco14t.blog
ツイッターでシェア
みんなに共有、忘れないようにメモ

choco

Crieitは誰でも投稿できるサービスです。 是非記事の投稿をお願いします。どんな軽い内容でも投稿できます。

また、「こんな記事が読みたいけど見つからない!」という方は是非記事投稿リクエストボードへ!

有料記事を販売できるようになりました!

こじんまりと作業ログやメモ、進捗を書き残しておきたい方はボード機能をご利用ください。
ボードとは?

コメント