Jes
Jes

Reputation: 65

Where do the HTTP header fields come from in PHP output (apart from header())

I have a PHP script that reads a file and outputs it to the client. It's a CSS file, so I've used header() to set Content-Type, Content-Length and Cache-Control. If I add a made-up header, I can see it using Tamper Data so it seems that basically it's working (and the file is received fine by the browser). What I don't understand is that I also see a number of other headers (eg. Expires) and and something actually changes my value of Content-Length - presumably because it's Content-Encoding: gzip. In php.ini it has zlib.output_compression = Off so I'm unsure what's jumping in at the last step to modify the headers. Can anyone explain this for me?

Thank you for your time.

Upvotes: 2

Views: 256

Answers (1)

Pekka
Pekka

Reputation: 449475

These headers come from the web server. PHP gets called to deliver the content (and any additional headers) but it's the web server that does the delivering, using its own rules and configuration settings.

Upvotes: 1

Related Questions