Check application/x-httpd-php in /etc/mime.types

The fact that this line is commented out by default in /etc/mime.types:

#application/x-httpd-php phtml pht php

is causing headaches. Could you add a test for it in the configuration check please?

See https://www.virtualmin.com/node/27971

Thanks!

Status: 
Closed (fixed)

Comments

Howdy -- that issue doesn't seem to occur on all setups, and I haven't run into problems with that on my test systems.

However, as you indicated, there are definitely a few folks who are seeing that.

Does that affect all PHP Execution Modes? Or just one or two of them?

Perhaps we could deal with this by putting an AddType directive into the Virtualhost block to remove any dependency on the mime.types file.

Does that affect all PHP Execution Modes?

Just mod_php.

Perhaps we could deal with this by putting an AddType directive into the Virtualhost block

Just confirmed that this works.

Eric - any reason you can think of not to have a directive like AddType application/x-httpd-php5 .php when in mod_php mode? In my brief tests, this seemed to work OK.

Jamie, after some additional testing, I was able to reproduce this issue on a freshly installed Ubuntu 14.04 system.

I wasn't able to resolve it using the AddType you mentioned, though the following one did appear to fix it:

AddType application/x-httpd-php .php

That is, "application/x-httpd-php5" didn't work, it needed to be "application/x-httpd-php". Though it didn't hurt to have both entries listed there.

In the solution you're suggesting, the "AddType" directive would just be when using mod_php, and would be removed when switching to CGI or FCGID? I can't think of any problems in doing that.

Ok, I've added code to add the directive AddType application/x-httpd-php .php , but only for mod_php and cgi modes (for which it was already being added).

What's odd is that on my test system, Virtualmin never needed this - however, this is an older Apache release.

I at first thought this must have just been an Ubuntu 14.04 issue, but you mentioning Apache 2.4 got me wondering if it might be Apache related, and not distro related.

And indeed, it is Apache related!

CentOS 7, which ships with Apache 2.4, has this same problem. Any website on CentOS 7 configured to use mod_php won't work properly, until the above "AddType" entry is added.

Once that entry is added into the Apache config for that domain, mod_php begins working properly.

Automatically closed -- issue fixed for 2 weeks with no activity.