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

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

问题描述

我正在使用基于 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).

我试过 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.

推荐答案

以下内容足以在该图像上简单地安装 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

构建它然后从结果图像中的 shell 运行会产生以下结果:

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天全站免登陆