Pacerier
Pacerier

Reputation: 89643

How to remove a header in PHP below 5.3?

How do we remove a header (e.g. Last-Modified) that has already been set but not yet sent over the wire?

(It may have been set by Apache, "pre"-PHP, and whatnot.)

I'm currently using PHP 5.2.17 and header_remove is an undefined function.

To be clear, I do not want to send a blank header line like header("Foo-bar:"). I want to completely remove it from the output buffer and send nothing.

Upvotes: 4

Views: 2364

Answers (2)

Amir Raminfar
Amir Raminfar

Reputation: 34169

Use mod_rewrite and modify .htaccess

Header unset Last-Modified

Upvotes: 2

NikiC
NikiC

Reputation: 101936

Update your PHP version or ask your hoster to update it. PHP 5.2 was EOLed several months ago and thus will not receive any further bug or security fixes. If you are 5.2 you are a security threat to yourself and everybody visiting your site. Updating your PHP version will additionally give you all the new features and performance improvements.

Apart from that: Restructure your logic so that the header isn't set in the first place. There is no way to completely remove the header in 5.2.

Upvotes: 0

Related Questions