+ php 8.1
* refactoring composer version & auth secrets apply separate for workspaces
This commit is contained in:
26
dockerfiles/php-fpm/xdebug2/xdebug.ini
Normal file
26
dockerfiles/php-fpm/xdebug2/xdebug.ini
Normal file
@ -0,0 +1,26 @@
|
||||
; 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
|
87
dockerfiles/php-fpm/xdebug2/xdebug.sh
Executable file
87
dockerfiles/php-fpm/xdebug2/xdebug.sh
Executable file
@ -0,0 +1,87 @@
|
||||
#! /bin/bash
|
||||
|
||||
# NOTE: At the moment, this has only been confirmed to work with PHP 7
|
||||
|
||||
PHP_VERSION=$2 # Without dot
|
||||
WITH_PROFILER=$3
|
||||
|
||||
# Grab full name of php-fpm container
|
||||
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}')
|
||||
|
||||
if [[ -z "${PHP_FPM_CONTAINER}" ]]; then
|
||||
echo "Unable to find php fpm container: php${PHP_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -z "${WITH_PROFILER}" ]]; then
|
||||
echo "With profiler option".
|
||||
fi
|
||||
|
||||
xdebug_status ()
|
||||
{
|
||||
echo 'xDebug status'
|
||||
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
xdebug_start ()
|
||||
{
|
||||
echo 'Start xDebug'
|
||||
|
||||
# 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"
|
||||
|
||||
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 restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
xdebug_stop ()
|
||||
{
|
||||
echo 'Stop xDebug'
|
||||
|
||||
# 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"
|
||||
|
||||
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-compose restart php-fpm
|
||||
docker restart $PHP_FPM_CONTAINER
|
||||
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
|
||||
}
|
||||
|
||||
|
||||
case $1 in
|
||||
stop|STOP)
|
||||
xdebug_stop
|
||||
;;
|
||||
start|START)
|
||||
xdebug_start
|
||||
;;
|
||||
status|STATUS)
|
||||
xdebug_status
|
||||
;;
|
||||
*)
|
||||
echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container."
|
||||
echo "xDebug must have already been installed."
|
||||
echo "Usage:"
|
||||
echo " .php-fpm/xdebug.sh 73|74 stop|start|status"
|
||||
|
||||
esac
|
||||
|
||||
exit 1
|
Reference in New Issue
Block a user