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
Answer from tianon on Stack Overflow Top answer 1 of 6
87
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
2 of 6
28
If you are concerned about image size you can remove the dependencies:
FROM wordpress:php7.1-fpm-alpine
RUN apk --update --no-cache add autoconf g++ make && \
pecl install -f xdebug && \
docker-php-ext-enable xdebug && \
apk del --purge autoconf g++ make
Docker Community
forums.docker.com › general
How to install xDebug on an php:alpine docker image? - General - Docker Community Forums
May 27, 2023 - 0 I am trying to install xDebug on a PHP Alpine Linux Docker image, and although xDebug is successfully installed for the CLI, phpinfo() on the web doesn’t report the extension loaded. I’m on Linux. How can I solve this? Here is the code: Dockerfile: FROM php:alpine RUN apk update && apk upgrade RUN apk add php-pear RUN apk add php-openssl RUN apk add bash RUN \ apk add --no-cache \ apache2-proxy \ apache2-ssl \ apache2-utils \ curl \ git \ logrotate \ ope...
How do I install XDebug?
I'm using wordpress:php7.1-fpm-alpine 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 ---> Runni... More on github.com
php - I get an error installing Xdebug on Alpine docker. What am I doing wrong? - Stack Overflow
I'm trying to install Xdebug on Alpine 3.17, but the different solutions I found with Google didn't work out. I'm a bit lost on this. I try to use PECL to install Xdebug as mentioned here. But I on... More on stackoverflow.com
How to add xdebug to php:8.1-fpm-alpine Docker container? - Stack Overflow
As I see the xdebug package has benne installed successfully and the docker-php-ext-enable xdebug command still not see the xdebug extension. I checked it with php -i and the xdebug isn't listed there. ... Thanks for ArmiMousavi & Derick's help here is a working final configuration. I just exploded one liner command to separated RUN to debug build issues. FROM php:8.1-fpm-alpine ... More on stackoverflow.com
Xdebug
xdebug.org › docs › install
Xdebug: Documentation » Installation
Installing Xdebug with a package manager is often the fastest way. Depending on your distribution, run the following command: Alpinelinux: sudo apk add php7-pecl-xdebug, or sudo apk add php8-pecl-xdebug
Alpine Linux
pkgs.alpinelinux.org › package › v3.21 › community › x86 › php82-pecl-xdebug
php82-pecl-xdebug - Alpine Linux packages
Package details · Depends (3) · php82-common · so:libc.musl-x86.so.1 · so:libz.so.1 · Required by (0) · Sub Packages (0) · Provides (1) · php82-xdebug · Install if (2)
Alpinelinux
forum.alpinelinux.org › forum › installation › how-do-i-install-php-xdebug-alpine
We cannot provide a description for this page right now
GitHub
github.com › bscheshirwork › docker-php › blob › master › yii2-alpine-xdebug › Dockerfile
docker-php/yii2-alpine-xdebug/Dockerfile at master · bscheshirwork/docker-php
# docker build -t bscheshir/php:fpm-alpine-4yii2-xdebug --pull -- . MAINTAINER BSCheshir <bscheshir.work@gmail.com> · # Install system packages & PHP extensions required for Yii 2.0 Framework ·
Author bscheshirwork
GitHub
github.com › zgraveyard › php-7.1-xdebug-alpine
GitHub - zgraveyard/php-7.1-xdebug-alpine: this is just a docker image for php 7.1 + xdeug based on alpine , for personal usage
Starred by 5 users
Forked by 6 users
Languages Dockerfile 70.5% | Shell 29.5% | Dockerfile 70.5% | Shell 29.5%
Medium
rinkesh-patel.medium.com › installing-xdebug-for-an-old-version-of-php-inside-a-docker-container-827f099d89d8
Installing XDebug for an old version of PHP inside a Docker container | by Rinkesh Patel | Medium
March 27, 2021 - You have a fairly stripped down version of Alpine Linux inside the container. You don’t have convenient service management commands like systemctl, service, or rc-service. Given the constraints, the options in front of you are as follows: Install through PHP Extension Community Library (PECL) ... Having exercised all the options, I can tell that the right way to install Xdebug for an old version of PHP is number 3 in the list above.
GitHub
github.com › docker-library › wordpress › issues › 244
How do I install XDebug? · Issue #244 · docker-library/wordpress
October 18, 2017 - I'm using wordpress:php7.1-fpm-alpine 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 ---> Runni...
Author chrissound
CopyProgramming
copyprogramming.com › howto › how-do-i-install-xdebug-on-docker-s-official-php-fpm-alpine-image
Php: Installing XDebug on Docker's Official PHP-FPM-Alpine Image: A Guide
April 14, 2023 - The provided information is enough to perform installing xdebug on the given picture. FROM wordpress:php7.1-fpm-alpine RUN apk add --no-cache $PHPIZE_DEPS \ && pecl install xdebug-2.5.0 \ && docker-php-ext-enable xdebug
Alpine Linux
pkgs.alpinelinux.org › package › v3.5 › community › x86 › php5-xdebug
Alpine Linux packages
December 11, 2016 - Package details · Depends (2) · Required by (0) · Sub Packages (2) · php-xdebug · php7-xdebug · © Copyright 2020 Alpine Linux Development Team all rights reserved | Privacy Policy
Stack Overflow
stackoverflow.com › questions › 75983540 › i-get-an-error-installing-xdebug-on-alpine-docker-what-am-i-doing-wrong
php - I get an error installing Xdebug on Alpine docker. What am I doing wrong? - Stack Overflow
I now tried to use the suggested image php:8.1-alpine3.17, but to no avail. I don't get an error anymore on the installation, but its not available afterwards. A php -v doesn't print out its existence. ... The clue is in: #7 0.416 /bin/sh: pecl: not found. If you want to use pecl, you need to install php81-pear with apk, but in general, you shouldn't compile your own extensions when packages, such as php81-pecl-xdebug are already available.
Top answer 1 of 3
10
Thanks for ArmiMousavi & Derick's help here is a working final configuration. I just exploded one liner command to separated RUN to debug build issues.
FROM php:8.1-fpm-alpine
WORKDIR /var/www/html
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted gnu-libiconv
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
ENV PHP_MEMORY_LIMIT=1G
ENV PHP_UPLOAD_MAX_FILESIZE: 512M
ENV PHP_POST_MAX_SIZE: 512M
RUN docker-php-ext-install pdo
RUN apk add --no-cache libpng libpng-dev && docker-php-ext-install gd && apk del libpng-dev
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
freetype \
libpng \
libjpeg-turbo \
freetype-dev \
libpng-dev \
jpeg-dev \
libwebp-dev \
libjpeg \
libjpeg-turbo-dev
RUN docker-php-ext-configure gd \
--with-freetype=/usr/lib/ \
--with-jpeg=/usr/lib/ \
--with-webp=/usr
RUN NUMPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \
&& docker-php-ext-install -j${NUMPROC} gd
RUN apk add --no-cache sqlite-libs
RUN apk add --no-cache icu sqlite git openssh zip
RUN apk add --no-cache --virtual .build-deps icu-dev libxml2-dev sqlite-dev curl-dev
RUN docker-php-ext-install \
bcmath \
curl \
ctype \
intl \
pdo \
pdo_sqlite \
xml
RUN apk del .build-deps
RUN docker-php-ext-enable pdo_sqlite
# Add xdebug
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS
RUN apk add --update linux-headers
RUN pecl install xdebug-3.1.5
RUN docker-php-ext-enable xdebug
RUN apk del -f .build-deps
# Configure Xdebug
RUN echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.log=/var/www/html/xdebug/xdebug.log" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.discover_client_host=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.client_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini
2 of 3
3
try this one and remove :
RUN apk add php81-pecl-xdebug
RUN docker-php-ext-enable xdebug
and instead replace with:
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
&& pecl install xdebug-3.0.0 \
&& docker-php-ext-enable xdebug \
&& apk del -f .build-deps
and then:
# Configure Xdebug
RUN echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.log=/var/www/html/xdebug/xdebug.log" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.discover_client_host=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.client_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini
and then let me know about the result
Docker Hub
hub.docker.com › r › zaherg › php-7.0-xdebug-alpine › dockerfile
Docker
Welcome to the world's largest container registry built for developers and open source contributors to find, use, and share their container images. Build, push and pull.