Use apache mod_expires to cache php, what is a mime type for php files?

305 views Asked by At

I want to cache php for few seconds in mod_expires, I can't find examples, nobody want to cache it (I know, I know).

What should I put into ExpiresByType to cache php?

2

There are 2 answers

0
Lithilion On BEST ANSWER

Debian uses text/x-php. https://packages.debian.org/sid/mime-support

The IANA suggests text/x-php or application/x-php. https://www.ietf.org/rfc/rfc4329.txt

Please note that text/php or application/php probably won't work.

0
AudioBubble On

What should I put into ExpiresByType to cache php?

Whatever Content-Type your PHP scripts are generating. text/html if they're generating HTML pages, for instance.

A better option is usually to generate Expires headers in PHP code.