Thank you for this script! It saved me a ton of time.

After the script finished, apache2 failed to restart, showing me "apache2ctl: command not found." I was able to resolve this by reinstalling...