title: Expires headers not working: using settings from elsewhere
body: <p>I have a PHP script masquerading as JS in order to dynamically include and pack various JS files to serve as one.</p>
  
  <p>I'm having trouble getting it to cache: the headers don't seem to want to set.</p>
  
  <pre><code>$expires = 60*60*24*14;
  header("Pragma: public");
  header("Cache-Control: maxage=".$expires);
  header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
  </code></pre>
  
  <p>I have that at the top of the script. I also have in .htaccess:</p>
  
  <pre><code>ExpiresByType application/x-javascript M2592000
  </code></pre>
  
  <p>However, it's not working and the HTTP response for the file is as follows:</p>
  
  <pre><code>Date    Tue, 30 Mar 2010 15:54:52 GMT
  Server  Apache
  X-Powered-By    PHP/5.2.12
  Pragma  no-cache
  Cache-Control   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  Expires Thu, 19 Nov 1981 08:52:00 GMT
  Vary    Accept-Encoding
  Content-Encoding    gzip
  Connection  close
  Transfer-Encoding   chunked
  Content-Type    application/x-javascript
  </code></pre>
  
  <p>How can I get it to cache this content?</p>