views:

217

answers:

1

I want my PHP pages to be cached. To allow cache I use:

session_cache_limiter('private');
session_cache_expire(180);
session_start();

Since I'm only using sessions for these cache headers, should I just drop these 3 line and replace them with (I'm never using $_SESSION):

header('Expires: <some GMT date>');
header('Cache-Control: private, max-age=<some GMT date in the future>, pre-check=<some GMT date in the future>');
header('Last-Modified: <some GMT date>');
+1  A: 

Yes, if your only reason for using sessions is strictly only for sending headers then use header()

Anthony Forloney