diff --git a/CHANGELOG.md b/CHANGELOG.md
index b950caea2..bde1b7fde 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,8 @@ permalink: /docs/en-US/changelog/
* Better error messages with links to docs when trying to use a PHP version that isn't installed ( #2689 )
* Opted out of Dotnet package telemetry ( #2689 )
* Replace references to the Squizlab PHPCS with that from the PHPCS Standards org ( #2692 )
+* Better PHP Debug mod switching outputs and checks ( #2702 )
+* PHP Info and Xdebug info pages now state their versions ( #2702 )
### Bug Fixes
diff --git a/config/homebin/switch_php_debugmod b/config/homebin/switch_php_debugmod
index 0999a4844..4e4477762 100755
--- a/config/homebin/switch_php_debugmod
+++ b/config/homebin/switch_php_debugmod
@@ -28,9 +28,21 @@ disable_phpmods() {
for phpv in $(phpquery -V)
do
if is_module_enabled_fpm "${phpv}" "${i}"; then
- vvv_info " ✘ Disabling active PHP v${phpv} debug mod: '${i}'"
- sudo phpdismod -q -s fpm -v "${phpv}" "${i}"
- sudo phpdismod -q -s cli -v "${phpv}" "${i}"
+ #vvv_info " ✘ Disabling active PHP v${phpv} debug mod: '${i}'"
+ #sudo phpdismod -q -s fpm -v "${phpv}" "${i}"
+ #sudo phpdismod -q -s cli -v "${phpv}" "${i}"
+
+ if sudo phpdismod -q -v "${phpv}" -s fpm "${i}"; then
+ vvv_success " - ✔ Disabled ${i} for PHP v${phpv} FPM"
+ else
+ vvv_error " - x Could not disable ${i} for PHP v${phpv} FPM"
+ fi
+
+ if sudo phpdismod -q -v "${phpv}" -s cli "${i}"; then
+ vvv_success " - ✔ Disabled ${i} for PHP v${phpv} CLI"
+ else
+ vvv_error " - x Could not disable ${i} for PHP v${phpv} CLI"
+ fi
fi
done
done
@@ -40,11 +52,19 @@ enable_phpmod() {
for phpv in $(phpquery -V)
do
if is_module_installed_fpm "${phpv}" "${1}"; then
- vvv_info " * Enabling '${1}' for PHP v${phpv}"
- sudo phpenmod -q -v "${phpv}" -s fpm "${1}"
- sudo phpenmod -q -v "${phpv}" -s cli "${1}"
+ if sudo phpenmod -q -v "${phpv}" -s fpm "${1}"; then
+ vvv_success " - ✔ Enabled ${1} for PHP v${phpv} FPM"
+ else
+ vvv_error " - x Could not enable ${1} for PHP v${phpv} FPM"
+ fi
+
+ if sudo phpenmod -q -v "${phpv}" -s cli "${1}"; then
+ vvv_success " - ✔ Enabled ${1} for PHP v${phpv} CLI"
+ else
+ vvv_error " - x Could not enable ${1} for PHP v${phpv} CLI"
+ fi
else
- vvv_info " * Skipped enabling ${1} in PHP v${phpv}, module isn't installed for this version"
+ vvv_info " - ? Skipped enabling ${1} in PHP v${phpv}, module isn't installed for this version"
fi
done
}
@@ -65,9 +85,19 @@ is_module_installed_fpm() {
restart_phpfpm() {
vvv_info " * Restarting PHP FPM services so that the change takes effect"
- find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \;
+ if find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \;; then
+ vvv_success " ✔ Completed restart sequence"
+ else
+ vvv_error " x One of the PHP services failed to restart, changes may not take effect."
+ fi
}
+
+vvv_info "Attempting to disable PHP debug mods and switch to ${mod}:"
+if [[ "${mod}" == "pcov" ]]; then
+ vvv_info " * pcov supports PHP 7.1 and above, it is not available for 5.6 and 7.0"
+fi
+
disable_phpmods phpmods[@]
if [[ "${mod}" == "none" ]]; then
@@ -76,10 +106,6 @@ if [[ "${mod}" == "none" ]]; then
exit 0
fi
-if [[ "${mod}" == "pcov" ]]; then
- vvv_info " * pcov supports PHP 7.1 and above, it is not available for 5.6 and 7.0"
-fi
-
# Tideways needs 2 mods enabling
if [[ "${mod}" == "tideways" ]]; then
enable_phpmod "xhgui"
@@ -91,11 +117,11 @@ fi
if [[ "${mod}" == "xdebug" ]]; then
# Ensure the log file for xdebug is group writeable.
- vvv_info " * Making sure log/php/xdebug-remote.log is readable and present"
+ vvv_info " * Making sure log/php/xdebug-remote.log is readable and present"
sudo touch /var/log/php/xdebug-remote.log
sudo chmod 664 /var/log/php/xdebug-remote.log
fi
enable_phpmod "${mod}"
restart_phpfpm
-vvv_success " ✔ PHP Debug mod switch to ${mod} on all available PHP versions complete."
+vvv_info " ✔ PHP Debug mod switch to ${mod} on all available PHP versions complete."
diff --git a/www/default/phpinfo/index.php b/www/default/phpinfo/index.php
index 26ea69dc9..3db25af90 100644
--- a/www/default/phpinfo/index.php
+++ b/www/default/phpinfo/index.php
@@ -4,10 +4,10 @@
*/
?>
diff --git a/www/default/xdebuginfo/index.php b/www/default/xdebuginfo/index.php
index 2a400b0ef..c8451be39 100644
--- a/www/default/xdebuginfo/index.php
+++ b/www/default/xdebuginfo/index.php
@@ -5,7 +5,6 @@
?>