File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -o errexit
4
+ set -o nounset
5
+ set -o pipefail
6
+ if [[ " ${TRACE-0} " == " 1" ]]; then
7
+ set -o xtrace
8
+ fi
9
+
10
+ if [[ " ${1-} " =~ ^-* h(elp)? $ ]]; then
11
+ echo " Usage: $0 [mode]
12
+
13
+ This script will change PHP INI files to enable the mode set in the argument,
14
+ if no argument is set it will fallback to \$ XDEBUG_MODE env.
15
+
16
+ If the mode is 'debug' you will need to set the following env vars:
17
+ - XDEBUG_IDEKEY
18
+ - XDEBUG_CLIENT_PORT
19
+ - XDEBUG_AUTOSTART (optional)
20
+ - XDEBUG_CONNECT_BACK (optional)
21
+ "
22
+ exit
23
+ fi
24
+
25
+ export ini_file=/usr/local/etc/php/conf.d/xdebug.ini
26
+ export MODE=${1:- off}
27
+ rm -f $ini_file || true
28
+
29
+ [[ $MODE == " off" ]] && exit
30
+
31
+ echo " zend_extension=xdebug.so" | tee -a $ini_file
32
+ echo " xdebug.mode=$MODE " | tee -a $ini_file
33
+ echo " xdebug.var_display_max_depth=5" | tee -a $ini_file
34
+
35
+ [[ $MODE =~ " debug" ]] && {
36
+ echo " xdebug.idekey=${XDEBUG_IDEKEY} " | tee -a $ini_file
37
+
38
+ client_port=${XDEBUG_REMOTE_PORT:- ${XDEBUG_CLIENT_PORT:- 9003} }
39
+ echo " xdebug.client_port=$client_port " | tee -a $ini_file
40
+
41
+ autostart=" no"
42
+ [[ ${XDEBUG_AUTOSTART} == true ]] && autostart=" yes"
43
+ echo " xdebug.start_with_request=$autostart " | tee -a $ini_file
44
+
45
+ back=" 0"
46
+ [[ ${XDEBUG_CONNECT_BACK} == true ]] && back=" 1"
47
+ echo " xdebug.discover_client_host=$back " | tee -a $ini_file
48
+ }
You can’t perform that action at this time.
0 commit comments