PHP and Apache2 broken after upgrade to Ubuntu 16.04

Ubuntu 16.04 comes with PHP 7.0. You need to install libapache2-mod-php package and then disable all traces of PHP5.

  1. Uninstall PHP5.x package: sudo apt-get purge php5-common (this will remove all PHP 5 packages.
  2. Install default (7.0) PHP apache2 SAPI: sudo apt-get install libapache2-mod-php
  3. If the apache2 is still broken do: sudo rm /etc/apache2/mods-enabled/php5.* to disable PHP5 mod and enable PHP 7.0 with sudo a2enmod php7.0.