Some users reported that they could not make PHP to render their PHP scripts / pages when they installed Apache webserver and PHP7 on Ubuntu 16.04 server / vps. Well, recently I found out that they might have just missed some dependencies to install. Ubuntu 16.04 comes with PHP7 package by default. Hence if you have managed to install via apt-get then most-likely you’ll have PHP7 to install. Some users blamed PHP7 incompatibility but since the phpinfo page doesn’t work that it means that PHP does not render any php pages. How to fix it then?
Actually it’s simple. The main cause is that libapache2 module and libapache2 for php7 module are not installed yet. Simply use apt-get command to install those missing modules and restart Apache2 to solve the problem :
apt-get install libapache2-mod-php -y
service apache2 restart
Please read my complete guide on how to install LAMP on Ubuntu 16.03 server.