如何在Docker的官方php-fpm-alpine映像上安装XDebug? [英] How do I install XDebug on docker's official php-fpm-alpine image?

查看:427
本文介绍了如何在Docker的官方php-fpm-alpine映像上安装XDebug?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 wordpress:php7.1-fpm-alpine ,它基于 php:7.1-fpm-alpine https://github.com /docker-library/wordpress/blob/master/php7.1/fpm-alpine/Dockerfile )。

I'm using wordpress:php7.1-fpm-alpine which is based on php:7.1-fpm-alpine (https://github.com/docker-library/wordpress/blob/master/php7.1/fpm-alpine/Dockerfile).

我尝试了运行pecl安装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.


推荐答案

下面的内容足以在该映像上简单地安装xdebug :

The following is sufficient for simply installing xdebug on that image:

FROM wordpress:php7.1-fpm-alpine

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

构建它,然后从结果图像中的外壳运行会产生以下内容:

Building that and then running from a shell inside the resulting image produces the following:

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

这篇关于如何在Docker的官方php-fpm-alpine映像上安装XDebug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆