My coworker and I recently spent a long amount of time trying to figure out why PHP 7 was showing as plain text in the browser rather than running. We found an upvoted StackOverflow answer that contained these commands.
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.0-fpm
sudo service apache2 restart
It fixed the problem, but unfortunately the answer did not include an explanation on what these commands do. We understand sudo service apache2 restart but not the first two lines. I searched online, but only found more instances of this code without a real explanation on how it works or why it was needed.
What do these commands do and when is it needed?