Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php ini_set expose_php

Tags:

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?

like image 337
David Avatar asked Feb 24 '10 22:02

David


3 Answers

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

It can only be set in php.ini.

like image 82
Matthew Avatar answered Nov 17 '22 20:11

Matthew


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.

like image 13
chris Avatar answered Nov 17 '22 21:11

chris


Overwrite the header:

header('X-Powered-By: ');
like image 7
Cropeck Avatar answered Nov 17 '22 21:11

Cropeck