Forum Moderators: coopster

Message Too Old, No Replies

Get rid of the X-Powered-By Server Header field

Alternatives for expose_php=off?

         

Yidaki

3:02 pm on Oct 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't have access to the php.ini file on one server so i can't use expose_php=off to suppress the X-Powered-By: PHP/1.0 Server Header.

I tried adding #!/usr/local/bin/php -q on top of the php code but that didn't remove the header. This only suppresses the header fields if the php is called via shell, right!?

Are there any alternatives that can be used directly within php pages or through htaccess?

bcolflesh

3:10 pm on Oct 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

php_flag expose_php Off

in .htaccess

Yidaki

4:00 pm on Oct 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>php_flag expose_php Off

No luck - returns 500. :(

coopster

4:12 pm on Oct 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are there any alternatives that can be used directly within php pages or through htaccess?

No, not on the expose_php configuration option. It is of type
PHP_INI_SYSTEM, which means the entry can be set in php.ini or httpd.conf.

Yidaki

5:13 pm on Oct 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok - found it out: allthough i can't access the default php.ini i can create a new one and put it into the directory where the php code runs.

I just created a php.ini with the following line:

<?php expose_php = off;?>

Now the X-Powered-By is gone. :)

Thanks anyway!

daisho

5:27 pm on Oct 3, 2003 (gmt 0)

10+ Year Member



Not sure how this will work but why not try:

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

to override the header. I'm not sure which will take president (PHP or your set header).

daisho.