Home > Geeky stuff > PHP headers

PHP headers

September 23, 2003

<b>headers and php</b><br><br>I was uploading all of my scripts on to my personal server and I was getting weird errors with my scripts that produce pdf’s. I finnally figuered it out after much hair pulling, I had to put headers to override the defaults for content type and cache control, I used some values I found on the web and they worked fine in php ver 4.2.X but not in 4.3 i had the following:
header(“Cache-Control: no-store, no-cache, must-revalidate”); // HTTP/1.1
header(“Cache-Control: post-check=0, pre-check=0”, false);
header(“Pragma: no-cache”); // HTTP/1.0
header(‘Content-type: application/vnd.pdf’);
turns out the false in 4.3 lets you put two headers of the same type, hince two cache control headers the first seems to take priority, in 4.2 it ignors the false and only puts in the second header and all is good. I really feel like an idiot for this such a simple thing because I am too lazy to understand what the cache headers do

Advertisements
Categories: Geeky stuff
%d bloggers like this: