instead of displaying the output, the php code is displayed code example
Example: on running php file showing code instead of view
sudo apt-get install php libapache2-mod-php
sudo a2enmod mpm_prefork && sudo a2enmod php7.0
sudo service apache2 restart