2017-10-19 134 views
4

我使用的是基於php:7.1-fpm-alpinehttps://github.com/docker-library/wordpress/blob/master/php7.1/fpm-alpine/Dockerfile)的wordpress:php7.1-fpm-alpine如何在Docker的官方php-fpm-alpine圖片上安裝XDebug?

我已經試過RUN pecl install xdebug-2.5.0 && docker-php-ext-enable xdebug

建設時導致錯誤:

Step 19/19 : RUN pecl install xdebug-2.5.0  && docker-php-ext-enable xdebug 
---> Running in 52c988e12cb2 
downloading xdebug-2.5.0.tgz ... 
Starting to download xdebug-2.5.0.tgz (267,640 bytes) 
........................................................done: 267,640 bytes 
76 source files, building 
running: phpize 
Configuring for: 
PHP Api Version:   20160303 
Zend Module Api No:  20160303 
Zend Extension Api No: 320160303 
Cannot find autoconf. Please check your autoconf installation and the 
$PHP_AUTOCONF environment variable. Then, rerun this script. 
+1

https://github.com/docker-library/wordpress/issues/244提供的解決方案是否工作? – Gordon

+0

嗯,我真的不認爲這是完整的解決方案。我需要確定所有的依賴關係。 –

回答

6

以下是足夠的僅僅是圖像上安裝了XDebug:

FROM wordpress:php7.1-fpm-alpine 

RUN apk add --no-cache $PHPIZE_DEPS \ 
    && pecl install xdebug-2.5.0 \ 
    && docker-php-ext-enable xdebug 

建立這一點,然後從產生的圖像中的外殼運行產生以下內容:

$ php -i | grep Xdebug 
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans