PHP via (f)cgi serves source code if mod_php5_cgi is present

I suggest the Virtualmin "Re-Check Configuration" feature should also check whether the Apache module php5_cgi is enabled - and if so whether php5_cgi.conf contains SetHandler application/x-httpd-php which should be commented out to make PHP via (f)cgi work correctly.

With recent PHP 5.4.13 this mod seems to be enabled by default and the .conf file does have that line.
I don't know about earlier versions, but at least 5.4.11 seems to have the same issue.

On my Ubuntu 10.04 system I had updated PHP to 5.4.13 and instantly .php files were not processed anymore but served to be downloaded as plaintext.

Also see this forum thread, where someone else experienced a similar problem, same resolution. He had this problem on a fresh(!) Ubuntu 12.04 server with PHP 5.4.11:



Howdy -- the Re-Check Config actually does test for that, but it only does so on distros that set that in their own PHP packages.

For example, if you're using Ubuntu or Debian with the standard PHP versions, the Re-Check Config will tell you if it sees the SetHandler lines uncommented.

However, some third party packages set that in different locations that Virtualmin doesn't know to check.

We're hoping to add in some additional checks for config files in popular third party repos.

In your case, what is the exact filename where that was located?

Oh yes, I could've thought of naming the exact file location myself ...

It's /etc/apache2/mods-enabled/php5_cgi.conf which in my case was symlinked to /etc/apache2/mods-available/php5_cgi.conf.

Based on the forum thread I've mentioned before I had first solved the problem by disabling php5-cgi and noticed only afterwards that its .conf file contained the "offending" lines.
(Afterwards I didn't bother crosschecking by enabling again and commenting out and in that line.)

Just a few days earlier I've installed Virtualmin on a fresh Ubuntu 10.04 server provided by my hosting provider (hosteurope). I don't know whether they've made any modifications but if they did Virtualmin had not problems with them. Everything worked like a charm.
Afterwards I manually updated PHP to 5.4.13 from an "unofficial" repo (since it's not officially available for 10.04). That's when either the php5-cgi module or the SetHandler line came in. I *assume* the module wasn't enabled before.