title: header expires on PHP file with JS output
body: <p>How to put an expires header on a PHP file which outout a JS file?</p>
  
  <h1>.htaccess</h1>
  
  <pre><code>ExpiresActive on
  ExpiresByType image/gif A29030400
  ExpiresByType image/jpeg A29030400
  ExpiresByType image/png A29030400
  ExpiresByType text/css A29030400
  ExpiresByType application/javascript A29030400
  </code></pre>
  
  <h1>header on JS file</h1>
  
  <pre><code>Cache-Control   max-age=29030400
  Connection  Keep-Alive
  Date    Thu, 18 Oct 2012 09:23:16 GMT
  Etag    "300000002c8ba-15f-4cc3069c72d00"
  Expires Thu, 19 Sep 2013 09:23:16 GMT
  Keep-Alive  timeout=5, max=94
  Server  Apache/2.2.22 (Win32) PHP/5.4.3
  </code></pre>
  
  <h1>header on PHP file which outputs a JS file</h1>
  
  <pre><code>Cache-Control   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  Connection  Keep-Alive
  Content-Length  1195
  Content-Type    application/javascript
  Date    Thu, 18 Oct 2012 09:23:16 GMT
  Expires Thu, 19 Nov 1981 08:52:00 GMT
  Keep-Alive  timeout=5, max=100
  Pragma  no-cache
  Server  Apache/2.2.22 (Win32) PHP/5.4.3
  X-Powered-By    PHP/5.4.3
  </code></pre>
  
  <h1>code PHP file</h1>
  
  <pre><code>&lt;?php
  header('Content-Type: application/javascript');
  $js_output = array('something' =&gt; 'some value');
  ?&gt;
  var &lt;?=json_encode($js_output)?&gt;
  </code></pre>