Skip to content

Commit 79ff092

Browse files
authored
Merge pull request laradock#273 from LarryEitel/fix-xdebugPhpFpm
fix-xdebugPhpFpm
2 parents 59a22ae + ffce0f9 commit 79ff092

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ services:
4747
extra_hosts:
4848
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
4949
- "dockerhost:10.0.75.1"
50+
ports:
51+
- "22:22"
5052
environment:
5153
# IMPORTANT: Set the Remote Interpreter entry matching name to `laravel`
5254
- PHP_IDE_CONFIG="serverName=laravel"

xdebugPhpFpm

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@
66
# Grab full name of php-fpm container
77
PHP_FPM_CONTAINER=$(docker-compose ps | grep php-fpm | cut -d" " -f 1)
88

9+
10+
# Grab OS type
11+
if [[ "$(uname)" == "Darwin" ]]; then
12+
OS_TYPE="OSX"
13+
else
14+
OS_TYPE=$(expr substr $(uname -s) 1 5)
15+
fi
16+
17+
918
xdebug_status ()
1019
{
1120
echo 'xDebug status'
1221

1322
# If running on Windows, need to prepend with winpty :(
14-
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then
23+
if [[ $OS_TYPE == "MINGW" ]]; then
1524
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
1625

1726
else
@@ -20,6 +29,7 @@ xdebug_status ()
2029

2130
}
2231

32+
2333
xdebug_start ()
2434
{
2535
echo 'Start xDebug'
@@ -30,7 +40,7 @@ xdebug_start ()
3040

3141

3242
# If running on Windows, need to prepend with winpty :(
33-
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then
43+
if [[ $OS_TYPE == "MINGW" ]]; then
3444
winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
3545
docker restart $PHP_FPM_CONTAINER
3646
winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
@@ -40,9 +50,9 @@ xdebug_start ()
4050
docker restart $PHP_FPM_CONTAINER
4151
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
4252
fi
43-
4453
}
4554

55+
4656
xdebug_stop ()
4757
{
4858
echo 'Stop xDebug'
@@ -52,7 +62,7 @@ xdebug_stop ()
5262

5363

5464
# If running on Windows, need to prepend with winpty :(
55-
if [[ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]]; then
65+
if [[ $OS_TYPE == "MINGW" ]]; then
5666
# This is the equivalent of:
5767
# winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla'
5868
# Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593

0 commit comments

Comments
 (0)