Jump to content

Cache Control not being set - PHP


Alex-Grim

Recommended Posts

Ok, this is driving me insane. I have no problem on the server level, but when trying to set cache control with PHP it simply will not work for me. I WANT cache, and LOTS of it!

 

$expires = 60*60*24*365;
$size = filesize("{$client_directory}/{$_GET['did']}");
header("Content-Length: ".$size,true);
header("Cache-Control: max-age={$expires}, public, no-transform",true);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT',true);
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()-$expires) . ' GMT',true);
header("Content-type: audio/example");
header("Content-Disposition: attachment; filename=\"{$_GET['did']}\"");
readfile("{$client_directory}/{$_GET['did']}");

 

ALL of the other headers are fine, but the cache control will NOT set??? I've tried so many different ways, and none of them are working. Here are the output headers:

 

Status=OK - 200
Date=Mon, 23 Nov 2009 08:15:19 GMT
Server=Apache/2.2.8 (Fedora)
Content-Length=4400274
Content-Disposition=attachment; filename="Coma.mp3"
Content-Encoding=gzip
Vary=Accept-Encoding
Keep-Alive=timeout=15, max=100
Connection=Keep-Alive
Content-Type=audio/example

 

Thanx

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.