-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxdebug
More file actions
executable file
·47 lines (41 loc) · 750 Bytes
/
xdebug
File metadata and controls
executable file
·47 lines (41 loc) · 750 Bytes
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
#!/bin/bash
warn()
{
if [ -z "$quiet" ] ; then
(>&2 echo -e "\e[1;38;05;9m$1\e[m")
fi
}
out()
{
if [ -z "$quiet" ]; then
echo "$1"
fi
}
throw()
{
warn "$1"
exit 1
}
if [ "$EUID" -ne 0 ]; then
sudo "$(readlink -f $0)"
exit 0
fi
isEnabled=$(php -m | grep xdebug)
distro=$(lsb_release -is)
case "$distro" in
'Ubuntu' | 'Debian')
phpv=$(php -r '$v = phpversion(); echo "{$v[0]}.{$v[2]}\n";')
if [ -z "$phpv" ]; then
throw "Can\'t php is not installed"
fi
if [ -z "$isEnabled" ] ; then
phpenmod -v "$phpv" xdebug
else
phpdismod -v "$phpv" xdebug
fi
systemctl restart "php${phpv}-fpm.service"
;;
*)
throw "Unsupported $distro distro"
;;
esac