|
8 | 8 | app="$(basename "$0")"
|
9 | 9 | command="$1"
|
10 | 10 | options="$2"
|
11 |
| - |
12 |
| -php_version_dot=$(php -r "\$v=explode('.', phpversion() ); echo implode('.', array_splice(\$v, 0, -1));") |
| 11 | +php_version_dot=$(php -r "\$v=explode('.', PHP_VERSION ); echo implode('.', array_splice(\$v, 0, -1));") |
13 | 12 | php_version="${php_version_dot//./}"
|
14 | 13 |
|
15 | 14 | xdebug_conf_path="$(brew --prefix)/etc/php/$php_version_dot/conf.d"
|
16 | 15 | xdebug_conf_file="ext-xdebug.ini"
|
17 |
| -xdebug_conf=$xdebug_conf_path/$xdebug_conf_file |
18 |
| -function keg_exists() { brew list php"${php_version}"-xdebug 2> /dev/null > /dev/null; } |
| 16 | +xdebug_conf=${xdebug_conf_path}/${xdebug_conf_file} |
| 17 | +extension_dir=$(php -r "echo PEAR_EXTENSION_DIR;") |
19 | 18 |
|
20 |
| -if keg_exists; then |
| 19 | +if [ ! -f "extension_dir"/xdebug.so ]; then |
21 | 20 | if [ ! -f "$xdebug_conf" ] && [ ! -f "$xdebug_conf.disabled" ]; then
|
22 | 21 | echo ""
|
23 | 22 | echo "The ini file for Xdebug was not found at '$xdebug_conf_path'"
|
24 |
| - echo "Did you install Xdebug via Homebrew?" |
| 23 | + echo "Did you install Xdebug via PECL?" |
25 | 24 | echo "For more informations: http://github.com/w00fz/xdebug-osx/blob/master/README.md"
|
26 | 25 | echo ""
|
27 | 26 |
|
@@ -51,7 +50,17 @@ if keg_exists; then
|
51 | 50 | STATUS="disabled"
|
52 | 51 | fi
|
53 | 52 |
|
54 |
| - if [ -f ~/Library/LaunchAgents/homebrew.mxcl.php"${php_version}".plist ]; then |
| 53 | + current_stable_php_path="/usr/local/opt/php/bin/php" |
| 54 | + if [ -f $(eval echo ${current_stable_php_path}) ]; then |
| 55 | + current_stable_php_version=$(${current_stable_php_path} -r "\$v=explode('.', PHP_VERSION ); echo implode('.', array_splice(\$v, 0, -1));") |
| 56 | + fi |
| 57 | + |
| 58 | + php_plist_file="~/Library/LaunchAgents/homebrew.mxcl.php@$php_version_dot.plist" |
| 59 | + if [ "${php_version_dot}" == "${current_stable_php_version}" ]; then |
| 60 | + php_plist_file="~/Library/LaunchAgents/homebrew.mxcl.php.plist" |
| 61 | + fi |
| 62 | + |
| 63 | + if [ -f $(eval echo ${php_plist_file}) ]; then |
55 | 64 | IS_PHP_FPM=true
|
56 | 65 | SERVER_NAME="php-fpm"
|
57 | 66 | fi
|
@@ -84,7 +93,7 @@ if keg_exists; then
|
84 | 93 | fi
|
85 | 94 | else
|
86 | 95 | echo ""
|
87 |
| - echo "Xdebug for PHP $php_version_dot was never installed or not installed via Brew." |
| 96 | + echo "Xdebug for PHP $php_version_dot was never installed or not installed via PECL." |
88 | 97 | echo "For more informations: http://github.com/w00fz/xdebug-osx/blob/master/README.md"
|
89 | 98 | echo ""
|
90 | 99 | exit 1
|
|
0 commit comments