Browse Source

+ xdebug3 feature for php 8.1

master
dimti 2 years ago
parent
commit
71d4b97c46
  1. 10
      bash/quit-xdebug.sh
  2. 8
      bash/start-xdebug.sh
  3. 29
      dockerfiles/php-fpm/xdebug3/xdebug.ini
  4. 18
      dockerfiles/php-fpm/xdebug3/xdebug.sh
  5. 1
      src/.env
  6. 3
      src/dockerfiles/php-fpm/php.base.Dockerfile
  7. 3
      src/dockerfiles/php-fpm/php.base56.Dockerfile
  8. 25
      src/dockerfiles/php-fpm/xdebug.ini
  9. 11
      src/dockerfiles/workspace/workspace.base.Dockerfile
  10. 1
      src/dockerfiles/workspace/workspace73.Dockerfile
  11. 1
      src/dockerfiles/workspace/workspace74.Dockerfile
  12. 1
      src/dockerfiles/workspace/workspace81.Dockerfile
  13. 8
      src/dockerfiles/workspace/xdebug2.Dockerfile
  14. 8
      src/dockerfiles/workspace/xdebug3.Dockerfile
  15. 2
      src/dockerfiles/workspace/xdebug3.ini

10
bash/quit-xdebug.sh

@ -6,5 +6,11 @@ WITH_PROFILER=$2
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi
${DIR}/dockerfiles/php-fpm/xdebug.sh stop ${PHP_VERSION} ${WITH_PROFILER}
${DIR}/dockerfiles/workspace/xdebug.sh stop ${PHP_VERSION} ${WITH_PROFILER}
POSSIBLE_XDEBUG_VERSION=xdebug2
if [[ $PHP_VERSION -gt 81 ]]; then
POSSIBLE_XDEBUG_VERSION=xdebug3
fi
${DIR}/dockerfiles/php-fpm/${POSSIBLE_XDEBUG_VERSION}/xdebug.sh stop ${PHP_VERSION} ${WITH_PROFILER}
${DIR}/dockerfiles/workspace/xdebug.sh stop ${PHP_VERSION} ${WITH_PROFILER}

8
bash/start-xdebug.sh

@ -6,5 +6,11 @@ WITH_PROFILER=$2
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi
${DIR}/dockerfiles/php-fpm/xdebug.sh start ${PHP_VERSION} ${WITH_PROFILER}
POSSIBLE_XDEBUG_VERSION=xdebug2
if [[ $PHP_VERSION -gt 81 ]]; then
POSSIBLE_XDEBUG_VERSION=xdebug3
fi
${DIR}/dockerfiles/php-fpm/${POSSIBLE_XDEBUG_VERSION}/xdebug.sh start ${PHP_VERSION} ${WITH_PROFILER}
${DIR}/dockerfiles/workspace/xdebug.sh start ${PHP_VERSION} ${WITH_PROFILER}

29
dockerfiles/php-fpm/xdebug3/xdebug.ini

@ -1,26 +1,3 @@
; NOTE: The actual xdebug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
;xdebug.remote_host=dockerhost
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.cli_color=0
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=/tmp/profiler
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=-1
xdebug.trace_enable_trigger=1
xdebug.trace_output_dir=/tmp/trace
xdebug.trace_output_name="trace.%t"
xdebug.show_exception_trace=1
xdebug.mode=off
xdebug.discover_client_host=1
xdebug.start_with_request=yes

18
dockerfiles/php-fpm/xdebug3/xdebug.sh

@ -31,16 +31,10 @@ xdebug_start ()
# And uncomment line with xdebug extension, thus enabling it
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=0/xdebug.remote_autostart=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=0/xdebug.remote_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
PROFILER_ENABLE_CDM="sed -i 's/^xdebug.profiler_enable=0/xdebug.profiler_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
MODE_DEBUG_CMD="sed -i 's/^xdebug.mode.*/xdebug.mode=debug/g' /usr/local/etc/php/conf.d/xdebug.ini"
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
if [[ ! -z "${WITH_PROFILER}" ]]; then
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_ENABLE_CDM}"
fi
docker exec -it $PHP_FPM_CONTAINER bash -c "${MODE_DEBUG_CMD}"
docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
}
@ -52,14 +46,10 @@ xdebug_stop ()
# Comment out xdebug extension line
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=1/xdebug.remote_autostart=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=1/xdebug.remote_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
PROFILER_DISABLE_CMD="sed -i 's/^xdebug.profiler_enable=1/xdebug.profiler_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
MODE_OFF_CMD="sed -i 's/^xdebug.mode.*/xdebug.mode=off/g' /usr/local/etc/php/conf.d/xdebug.ini"
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_DISABLE_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${MODE_OFF_CMD}"
# docker-compose restart php-fpm
docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'

1
src/.env

@ -7,7 +7,6 @@ WORKSPACE_INSTALL_MYSQL_CLIENT=true
WORKSPACE_INSTALL_FSWATCH=false
WORKSPACE_INSTALL_PING=true
WORKSPACE_INSTALL_S3_MINIO_CLIENT=true
WORKSPACE_INSTALL_XDEBUG=true
WORKSPACE_INSTALL_BZ2=true
# PHP-extensions already installed: INTL, PGSQL, BCMATH
WORKSPACE_INSTALL_WP_CLI=true

3
src/dockerfiles/php-fpm/php.base.Dockerfile

@ -14,9 +14,6 @@ RUN apt-get update && docker-php-ext-install pdo pdo_mysql \
# xDebug:
###########################################################################
# Copy xdebug configuration for remote debugging
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \

3
src/dockerfiles/php-fpm/php.base56.Dockerfile

@ -14,9 +14,6 @@ RUN apt-get update && docker-php-ext-install pdo pdo_mysql \
# xDebug:
###########################################################################
# Copy xdebug configuration for remote debugging
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \

25
src/dockerfiles/php-fpm/xdebug.ini

@ -1,25 +0,0 @@
; NOTE: The actual xdebug.so extension is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
;xdebug.remote_host=dockerhost
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.cli_color=0
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=/tmp
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=-1
xdebug.trace_enable_trigger=1
xdebug.trace_output_dir=/tmp
xdebug.trace_output_name="trace.%t"

11
src/dockerfiles/workspace/workspace.base.Dockerfile

@ -170,13 +170,7 @@ RUN if [ ${INSTALL_S3_MINIO_CLIENT} = true ]; then \
# xDebug:
###########################################################################
# Copy xdebug configuration for remote debugging
COPY ./xdebug.ini /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
pecl install xdebug-2.5.5; \
elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
pecl install xdebug-3.1.6; \
@ -184,8 +178,7 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
pecl install xdebug-2.9.8; \
fi && \
echo ';zend_extension=xdebug.so' > /etc/php/${PHP_VERSION}/cli/conf.d/20-xdebug.ini && \
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/vendor/bin/phpunit'" >> ~/.bashrc \
;fi
echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/vendor/bin/phpunit'" >> ~/.bashrc
###########################################################################
# BZ2:

1
src/dockerfiles/workspace/workspace73.Dockerfile

@ -6,3 +6,4 @@ ENV PHP_VERSION ${PHP_VERSION}
INCLUDE+ ./workspace.base.Dockerfile
INCLUDE+ ./composer1.Dockerfile
INCLUDE+ ./xdebug2.Dockerfile

1
src/dockerfiles/workspace/workspace74.Dockerfile

@ -6,3 +6,4 @@ ENV PHP_VERSION ${PHP_VERSION}
INCLUDE+ ./workspace.base.Dockerfile
INCLUDE+ ./composer1.Dockerfile
INCLUDE+ ./xdebug2.Dockerfile

1
src/dockerfiles/workspace/workspace81.Dockerfile

@ -6,3 +6,4 @@ ENV PHP_VERSION ${PHP_VERSION}
INCLUDE+ ./workspace.base.Dockerfile
INCLUDE+ ./composer2.Dockerfile
INCLUDE+ ./xdebug3.Dockerfile

8
src/dockerfiles/workspace/xdebug2.Dockerfile

@ -0,0 +1,8 @@
###########################################################################
# xDebug:
###########################################################################
USER root
# Copy xdebug configuration for remote debugging
COPY ./xdebug2.ini /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini

8
src/dockerfiles/workspace/xdebug3.Dockerfile

@ -0,0 +1,8 @@
###########################################################################
# xDebug:
###########################################################################
USER root
# Copy xdebug configuration for remote debugging
COPY ./xdebug3.ini /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini

2
src/dockerfiles/workspace/xdebug3.ini

@ -0,0 +1,2 @@
xdebug.mode=debug
xdebug.start_with_request=yes
Loading…
Cancel
Save