Last-Modified header always shows 1 jan 1970

47 Views Asked by At

I add these headers in my PHP:

header('Content-Description: File Transfer');
header('Content-Type: '.$mime);
header('Content-Disposition: attachment; filename=' . $quoted); 
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Last-Modified: '.$last_modified);
header('X-TEST: '.$last_modified);
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

The strange this is (when using wget), that the Last-Modified header show something else than the X-TEST header:

  HTTP/1.1 200 OK
  Date: Fri, 22 Dec 2023 10:51:03 GMT
  Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9
  X-Powered-By: PHP/7.4.27
  Content-Description: File Transfer
  Content-Disposition: attachment; filename="export.csv"
  Content-Transfer-Encoding: binary
  Connection: Keep-Alive, Keep-Alive
  Expires: 0
  X-TEST: Friday, 22nd December, 2023 @ 10:19am
  Cache-Control: must-revalidate, post-check=0, pre-check=0
  Pragma: public
  Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT
  Keep-Alive: timeout=5, max=99
  Transfer-Encoding: chunked
  Content-Type: text/plain;charset=UTF-8
0

There are 0 best solutions below