parsed.org
Turning Off PHP Caching by cygnus on Dec 31, 2005 04:07 PM

When using sessions in PHP, the default PHP configuration causes PHP to send a no-cache header to your browser so that session-managed pages are not cached. Sometimes this is not the desired behavior, such as when writing a script whose output is binary data such as images which are stored in a database. If this is the case, you can turn off the caching by using functions to modify the PHP configuration on a per-request basis. Call these functions before calling the session_start() function:

// Let the browser and proxies cache output
session_cache_limiter('public');

// One-day (60 * 24, in minutes) cache expiration time for output
session_cache_expire(60 * 24);

(Note: this behavior is documented at http://www.php.net/manual/en/ref.session.php.)

functionsheadershttplanguagesphpprogrammingsession
RSS