We recently switched our Apache 2.4.7 mode from mpm_pre-fork to mpm_event.
Since then we haven't been able to get our Files
directive to work.
<Files "*.php">
Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
</Files>
I did manage to get working with this convoluted mess:
<Files ~ "((^$)|(php))">
But, according to my regex knowledge, this will match files with "php" anywhere in the file name.
I found the need to match the "null" case from this other question.
We've also tried FilesMatch
with the same result.
None of this makes any sense from what I can tell from the Apache 2.4 documentation. Has anyone else seen anything like this problem?
UPDATE: I rolled the server back to mpm_preforker and mod_php with no change. I then purged apache and php, re-installed as mpm_preforker and it worked again. I then upgraded to mpm_event and php-fpm and it stopped working after a bit. I'm trying to isolate where it breaks and will post what I find.
UPDATE2:
This appears to be related to the fastcgi or php-fpm stuff.
I have two <Files>
directives, one for html
and one for php
that generate unique headers:
<Files *.html>
Header always set X-Aaron-files "html match"
</Files>
<Files *.php>
Header always set X-Aaron-files "php match"
</Files>
If I go to a fictitious php
file, then I get a 404 message with the header for php-match
.
BUT if I go to a real php
file, then the server executes the php file but does NOT return the headers indicating a php
file match.