I have noticed that files delivered by PHP through readfile
or fpassthru
techniques are never cached by the browser.
How can I "encourage" browsers to cache items delivered via these methods?
I have noticed that files delivered by PHP through readfile
or fpassthru
techniques are never cached by the browser.
How can I "encourage" browsers to cache items delivered via these methods?
Whether your content is cached or not has nothing to do with readfile() and consorts, but probably the default caching headers issued by the server (that would activate caching for HTML pages and image resources) don't apply when you use PHP to pass through files.
You will have to send the appropriate headers along with your content, telling the browser that caching for this resource is all right.
See for example