Merge pull request #273 from LarryEitel/fix-xdebugPhpFpm

fix-xdebugPhpFpm
This commit is contained in:
Mahmoud Zalt 2016-09-01 11:47:33 +03:00 committed by GitHub
commit 79ff092105
2 changed files with 16 additions and 4 deletions

View File

@ -47,6 +47,8 @@ services:
extra_hosts: extra_hosts:
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
- "dockerhost:10.0.75.1" - "dockerhost:10.0.75.1"
ports:
- "22:22"
environment: environment:
# IMPORTANT: Set the Remote Interpreter entry matching name to `laravel` # IMPORTANT: Set the Remote Interpreter entry matching name to `laravel`
- PHP_IDE_CONFIG="serverName=laravel" - PHP_IDE_CONFIG="serverName=laravel"

View File

@ -6,12 +6,21 @@
# Grab full name of php-fpm container # Grab full name of php-fpm container
PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1) PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1)
# Grab OS type
if [[ "$(uname)" == "Darwin" ]]; then
OS_TYPE="OSX"
else
OS_TYPE=$(expr substr $(uname -s) 1 5)
fi
xdebug_status () xdebug_status ()
{ {
echo 'xDebug status' echo 'xDebug status'
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then if [[ $OS_TYPE == "MINGW" ]]; then
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
else else
@ -20,6 +29,7 @@ xdebug_status ()
} }
xdebug_start () xdebug_start ()
{ {
echo 'Start xDebug' echo 'Start xDebug'
@ -30,7 +40,7 @@ xdebug_start ()
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ "$(expr substr $(uname -s) 1 5)" == "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}"
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'
@ -40,9 +50,9 @@ xdebug_start ()
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
} }
xdebug_stop () xdebug_stop ()
{ {
echo 'Stop xDebug' echo 'Stop xDebug'
@ -52,7 +62,7 @@ xdebug_stop ()
# If running on Windows, need to prepend with winpty :( # If running on Windows, need to prepend with winpty :(
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then if [[ $OS_TYPE == "MINGW" ]]; then
# This is the equivalent of: # This is the equivalent of:
# 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