Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install XDebug on docker's official php-fpm-alpine image?

Tags:

php

docker

alpine

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).

I've tried RUN pecl install xdebug-2.5.0 && docker-php-ext-enable xdebug

which results in an error when building:

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. 
like image 353
Chris Stryczynski Avatar asked Oct 19 '17 08:10

Chris Stryczynski


People also ask

What is Docker PHP ext enable?

docker-php-ext-enableThis command is used to start PHP extension of When we use pecl to install the PHP extension, the extension is not started by default. If you want to use this extension, you must configure it in the php. ini configuration file to use this PHP extension.


1 Answers

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 
like image 185
tianon Avatar answered Oct 04 '22 10:10

tianon