Skip to content

Instantly share code, notes, and snippets.

@haipham22
Last active September 6, 2021 07:24
Show Gist options
  • Save haipham22/841d7714920ab911204a9d266cdf113a to your computer and use it in GitHub Desktop.
Save haipham22/841d7714920ab911204a9d266cdf113a to your computer and use it in GitHub Desktop.
PHP - Xdebug 3 Configuration

Install xdebug on docker image

install-php-extensions xdebug

FROM php:7.4-fpm-alpine
RUN mkdir -p /app
# Set working directory
WORKDIR /app
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions \
&& sync \
# && install-php-extensions @composer xdebug gd pdo_mysql mysqli zip exif \
&& install-php-extensions @composer gd pdo_mysql mysqli zip exif \
&& rm -rf /var/cache/apk/*
# Copy composer.lock and composer.json
COPY . /app
# Copy existing application directory contents
RUN chown -R www-data:www-data /app/
USER www-data
# Expose port 9000 and start php-fpm server
EXPOSE 9000
ENTRYPOINT ["php-fpm"]
[xdebug]
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment