7

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?

1 Answer 1

3

OK, a2enmod is a script that enables the specified module within the apache2 configuration.

The module proxy_fcgi provides support for the FastCGI protocol. The associated setenvif sets the variables sent to the FastCGI.

The a2enconf script enables the specified configuration file within apache2, in this case php7.0-fpm (which I assume configures PHP 7.0 - I've not played with this one).

Hope that helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .