-
Notifications
You must be signed in to change notification settings - Fork 2
/
xdebug.sh
executable file
·48 lines (40 loc) · 1.05 KB
/
xdebug.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# (De-)Activate xdebug for the currently running container
enable_xdebug () {
cp /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini.bak /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
cp /usr/local/etc/php/conf.d/xdebug.ini.bak /usr/local/etc/php/conf.d/xdebug.ini
}
disable_xdebug () {
rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
rm -f /usr/local/etc/php/conf.d/xdebug.ini
}
show_status() {
if [ -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then
echo "xdebug is enabled"
else
echo "xdebug is disabled"
fi
}
case $1 in
'1' | 'on' | 'enable')
enable_xdebug
show_status
;;
'0' | 'off' | 'disable')
disable_xdebug
show_status
;;
'toggle')
if [ -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini ]; then
disable_xdebug
else
enable_xdebug
fi
show_status
;;
'status' | *)
show_status
;;
esac
# Tell php-fpm to reload config
pkill -USR2 php-fpm