David
David

Reputation: 2423

php ini_set expose_php

I am trying to get expose_php to off with ini_set, except it seems to not be working. I tried the value 0, and Off, but neither work.

ini_set('expose_php',0);

help?

Upvotes: 10

Views: 8902

Answers (4)

chris
chris

Reputation: 1065

If you are on PHP >= 5.3.0:

header_remove('X-Powered-By');

http://www.php.net/manual/en/function.header-remove.php

Or on an older version:

header('X-Powered-By: ');

(This will hide PHP and the version, but the "X-Powered-By" string will still be visible in the header.)

However the PHP version might still be visible in the "Server: " part of the header. So this isn't bulletproof.

Upvotes: 14

Cropeck
Cropeck

Reputation: 71

Overwrite the header:

header('X-Powered-By: ');

Upvotes: 7

Matthew
Matthew

Reputation: 48304

http://php.net/manual/en/ini.core.php

It can only be set in php.ini.

Upvotes: 17

brettkelly
brettkelly

Reputation: 28235

ini_set('display_errors','0');

Both parameters need to be strings, as I recall. Try that.

Upvotes: -2

Related Questions