Fix Xdebug 3 compatibility with PHP 7.3 and 7.4
- Allow to set custom Xdebug port - Update Xdebug to v3.1.4
This commit is contained in:
		@@ -205,6 +205,7 @@ WORKSPACE_INSTALL_TRADER=false
 | 
			
		||||
WORKSPACE_PROTOC_VERSION=latest
 | 
			
		||||
WORKSPACE_INSTALL_MEMCACHED=true
 | 
			
		||||
WORKSPACE_INSTALL_EVENT=false
 | 
			
		||||
WORKSPACE_XDEBUG_PORT=9003
 | 
			
		||||
 | 
			
		||||
### PHP_FPM ###############################################
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -74,6 +74,7 @@ services:
 | 
			
		||||
          - INSTALL_GMP=${WORKSPACE_INSTALL_GMP}
 | 
			
		||||
          - INSTALL_GNUPG=${WORKSPACE_INSTALL_GNUPG}
 | 
			
		||||
          - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
 | 
			
		||||
          - XDEBUG_PORT=${WORKSPACE_XDEBUG_PORT}
 | 
			
		||||
          - INSTALL_PCOV=${WORKSPACE_INSTALL_PCOV}
 | 
			
		||||
          - INSTALL_PHPDBG=${WORKSPACE_INSTALL_PHPDBG}
 | 
			
		||||
          - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
 | 
			
		||||
@@ -218,6 +219,7 @@ services:
 | 
			
		||||
          - INSTALL_GMP=${PHP_FPM_INSTALL_GMP}
 | 
			
		||||
          - INSTALL_GNUPG=${PHP_FPM_INSTALL_GNUPG}
 | 
			
		||||
          - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
 | 
			
		||||
          - XDEBUG_PORT=${PHP_FPM_XDEBUG_PORT}
 | 
			
		||||
          - INSTALL_PCOV=${PHP_FPM_INSTALL_PCOV}
 | 
			
		||||
          - INSTALL_PHPDBG=${PHP_FPM_INSTALL_PHPDBG}
 | 
			
		||||
          - INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
 | 
			
		||||
@@ -294,8 +296,6 @@ services:
 | 
			
		||||
        - ./php-fpm/php${PHP_VERSION}.ini:/usr/local/etc/php/php.ini
 | 
			
		||||
        - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
 | 
			
		||||
        - docker-in-docker:/certs/client
 | 
			
		||||
      ports:
 | 
			
		||||
        - "${PHP_FPM_XDEBUG_PORT}:9003"
 | 
			
		||||
      expose:
 | 
			
		||||
        - "9000"
 | 
			
		||||
      extra_hosts:
 | 
			
		||||
 
 | 
			
		||||
@@ -212,12 +212,13 @@ RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \
 | 
			
		||||
###########################################################################
 | 
			
		||||
 | 
			
		||||
ARG INSTALL_XDEBUG=false
 | 
			
		||||
ARG XDEBUG_PORT=9003
 | 
			
		||||
 | 
			
		||||
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
 | 
			
		||||
  # Install the xdebug extension
 | 
			
		||||
  # https://xdebug.org/docs/compat
 | 
			
		||||
  if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \
 | 
			
		||||
    pecl install xdebug-3.1.2; \
 | 
			
		||||
    pecl install xdebug-3.1.4; \
 | 
			
		||||
  else \
 | 
			
		||||
    if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
 | 
			
		||||
      pecl install xdebug-2.5.5; \
 | 
			
		||||
@@ -235,10 +236,10 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
 | 
			
		||||
# Copy xdebug configuration for remote debugging
 | 
			
		||||
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
 | 
			
		||||
 | 
			
		||||
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
 | 
			
		||||
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \
 | 
			
		||||
  sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /usr/local/etc/php/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_connect_back=0/xdebug.discover_client_host=false/" /usr/local/etc/php/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_port=9000/xdebug.client_port=9003/" /usr/local/etc/php/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_port=9000/xdebug.client_port=${XDEBUG_PORT}/" /usr/local/etc/php/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.profiler_enable=0/; xdebug.profiler_enable=0/" /usr/local/etc/php/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.profiler_output_dir=/xdebug.output_dir=/" /usr/local/etc/php/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_mode=req/; xdebug.remote_mode=req/" /usr/local/etc/php/conf.d/xdebug.ini && \
 | 
			
		||||
 
 | 
			
		||||
@@ -327,13 +327,14 @@ RUN set -eux; \
 | 
			
		||||
USER root
 | 
			
		||||
 | 
			
		||||
ARG INSTALL_XDEBUG=false
 | 
			
		||||
ARG XDEBUG_PORT=9003
 | 
			
		||||
 | 
			
		||||
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
 | 
			
		||||
  # Install the xdebug extension
 | 
			
		||||
  # https://xdebug.org/docs/compat
 | 
			
		||||
  apt-get install -yqq pkg-config php-xml php${LARADOCK_PHP_VERSION}-xml && \
 | 
			
		||||
  if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \
 | 
			
		||||
    pecl install xdebug-3.1.2; \
 | 
			
		||||
    pecl install xdebug-3.1.4; \
 | 
			
		||||
  else \
 | 
			
		||||
    if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
 | 
			
		||||
      pecl install xdebug-2.5.5; \
 | 
			
		||||
@@ -351,10 +352,10 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
 | 
			
		||||
# ADD for REMOTE debugging
 | 
			
		||||
COPY ./xdebug.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini
 | 
			
		||||
 | 
			
		||||
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
 | 
			
		||||
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \
 | 
			
		||||
  sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_connect_back=0/xdebug.discover_client_host=false/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_port=9000/xdebug.client_port=9003/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_port=9000/xdebug.client_port=${XDEBUG_PORT}/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.profiler_enable=0/; xdebug.profiler_enable=0/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.profiler_output_dir=/xdebug.output_dir=/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
 | 
			
		||||
  sed -i "s/xdebug.remote_mode=req/; xdebug.remote_mode=req/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user