[Alpine Linux]php:7.2-fpm-alpineでのxdebugインストール方法

LINEで送る
Pocket

 

  • Dockerfile
FROM php:7.2-fpm-alpine

ENV APP_ROOT /var/www/hoge
WORKDIR $APP_ROOT

# Setup UTC+9
RUN apk --update add tzdata && \
    cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
    apk del tzdata && \
    rm -rf /var/cache/apk/*

# install packages
RUN apk update && \
    apk upgrade && \
    apk add --update --no-cache \
    autoconf \
    bash \
    build-base \
    curl-dev \
    freetype-dev \
    g++ \
    gcc \
    git \
    libjpeg-turbo-dev \
    libpng-dev \
    libxml2-dev \
    libxslt-dev \
    make \
    mysql-dev \
    nginx \
    openssh \
    openssl \
    py3-pip \
    sudo \
    supervisor \
    tzdata \
    vim \
    yaml-dev \
    zlib-dev

RUN docker-php-ext-install pdo_mysql soap

RUN docker-php-ext-configure gd \
    --with-gd \
    --with-freetype-dir=/usr/include/ \
    --with-png-dir=/usr/include/ \
    --with-jpeg-dir=/usr/include/ && \
    NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) && \
    docker-php-ext-install -j${NPROC} gd

# Install awscli
RUN pip install awscli

# PHP 
RUN rm -f /usr/local/etc/php-fpm.conf.default
RUN rm -f /usr/local/etc/php-fpm.d/zz-docker.conf
COPY php/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY php/php.ini /usr/local/etc/php/php.ini
COPY php/www.conf /usr/local/etc/php-fpm.d/www.conf

# Install xdebug 
RUN pecl install xdebug 
RUN docker-php-ext-enable xdebug
~省略~
  • /usr/local/etc/php/php.ini 
#追加
[xdebug]
zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so"
  • 確認
# php -v
Cannot load Xdebug - it was already loaded
PHP 7.2.34 (cli) (built: Nov  6 2020 00:45:31) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *