Browse Source

+ remote_autostart & remote_enable in xdebug set to 1 with xdebug start

master
dimti 4 years ago
parent
commit
9103721fbe
  1. 17
      dockerfiles/php-fpm/xdebug.sh

17
dockerfiles/php-fpm/xdebug.sh

@ -40,18 +40,22 @@ xdebug_start ()
echo 'Start xDebug' echo 'Start xDebug'
# And uncomment line with xdebug extension, thus enabling it # 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"
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"
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
docker restart $PHP_FPM_CONTAINER docker restart $PHP_FPM_CONTAINER
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
else else
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" 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}"
docker restart $PHP_FPM_CONTAINER docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
fi fi
@ -64,7 +68,8 @@ xdebug_stop ()
# Comment out xdebug extension line # 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" 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"
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ $OS_TYPE == "MINGW" ]]; then if [[ $OS_TYPE == "MINGW" ]]; then
@ -72,12 +77,16 @@ xdebug_stop ()
# winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla' # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla'
# Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593 # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}" winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
docker restart $PHP_FPM_CONTAINER docker restart $PHP_FPM_CONTAINER
#docker-compose restart php-fpm #docker-compose restart php-fpm
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
else else
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}" 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-compose restart php-fpm # docker-compose restart php-fpm
docker restart $PHP_FPM_CONTAINER docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'

Loading…
Cancel
Save