Skip to content

Commit bef1876

Browse files
authored
Setup Wizard: improve PHP error handling (#1357)
1 parent 765ce43 commit bef1876

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

install-photobooth.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,8 @@ function set_php_version_cli() {
765765
local priority
766766
priority=$(echo "$version" | tr -d '.')
767767

768-
update-alternatives --install /usr/bin/php php "$php_bin" "$priority" >/dev/null 2>&1
769-
update-alternatives --set php "$php_bin" >/dev/null 2>&1
768+
update-alternatives --install /usr/bin/php php "$php_bin" "$priority" >/dev/null 2>&1 || warn "Failed to install PHP via update-alternatives."
769+
update-alternatives --set php "$php_bin" >/dev/null 2>&1 || error "Failed to set default PHP CLI version."
770770

771771
info "PHP CLI" "CLI php now points to: $(php -v | head -n1)"
772772
return 0
@@ -783,7 +783,15 @@ function set_php_version_apache() {
783783
a2dismod -f php* >/dev/null 2>&1 || true
784784

785785
if a2enmod "php${version}" >/dev/null 2>&1; then
786-
confirm "Apache Webserver" "Apache is now configured to use PHP ${version} (Note: Apache will apply this on next boot!)."
786+
confirm "Apache Webserver" "Apache is now configured to use PHP ${version} "
787+
if [[ "$HAS_SYSTEMD" == true ]]; then
788+
if systemctl is-active --quiet apache2; then
789+
# Restart if already running
790+
if ! systemctl restart apache2 &>/dev/null; then
791+
confirm "Apache Webserver" "Failed to restart Apache Webserver. Please reboot to apply."
792+
fi
793+
fi
794+
fi
787795
return 0
788796
else
789797
error "Could not enable php${version} for Apache" >&2

0 commit comments

Comments
 (0)