I'm on Ubuntu 16.04. I had a working installation of Apache2 + PHP7, but for various reasons I wanted to reinstall both.
I ran apt-get purge apache2 php libapache2-mod-php and then rm -rf /var/www /etc/apache2 because there were still some files that didn't get removed by apt.
Then I ran apt-get install apache2 php libapache2-mod-php, and Apache installed fine, but when I create a file, input <?php phpinfo(); and navigate to it, I just see the raw text!
When I was installing it for the first time I didn't have to do anything more than install the three mentioned packages, so I can't figure out why removing and installing them a second time wouldn't work (especially as I manually removed the configuration directories). I guess there's still something left over from the initial installation?
Any ideas?