Wiki / Version disclosure

Warning: X-Powered-By reveals the technologyX-Powered-By: PHP/8.4.14

The response says which software builds the pages and, with PHP, its exact version. That is not a hole in itself, but it tells automated scanners which sites to try a version-specific exploit on. Low urgency: one setting.

What it does not mean. It does not mean PHP is outdated: that is judged by the separate report line “PHP version”, which reads the version from this very header. Switch the header off and that line disappears too, while PHP itself stays what it was.

Aleksandr IzmalkovFacts checked:

In our report
Warning (yellow), category weight 0.5 of 2.0
Time to fix
5 minutes plus a restart of PHP or the web server
Can it break things
The header controls nothing. Only a wrongly placed line breaks things (see below)

How to fix it

The most reliable place to switch it off is where it is produced: the PHP settings. The web server lines are for when php.ini is out of your reach.

PHP, php.ini (tested with 8.4.14)

expose_php = Off

Can be changed in php.ini only; restart PHP-FPM or the web server afterwards. PHP ships with it on; the Ubuntu package on our test server (PHP 8.3.6) already has it off.

Without access to php.ini (tested with 8.4.14)

<?php header_remove('X-Powered-By');

The line has to sit in a file every request loads and run before any output is sent.

nginx (tested on 1.26.3 with PHP 8.3.6 over FastCGI)

fastcgi_hide_header X-Powered-By;

Goes into http, server or location. If nginx passes requests to another server with proxy_pass, the equivalent is proxy_hide_header X-Powered-By; (also tested).

Apache (tested on 2.4.59, also works in .htaccess)

Header always unset X-Powered-By
Header unset X-Powered-By

You need both lines. With PHP running through PHP-FPM (mod_proxy_fcgi) or CGI, only the always line removed the header. With Apache passing requests to another server through ProxyPass, only the line without always did. Not tested with mod_php.

Terminal: the PHP built-in server sends X-Powered-By: PHP/8.4.14, and with expose_php=0 the header is gone
PHP 8.4.14 built-in server on 18 November 2026: the default response, the same with expose_php off, and an attempt to switch it off from code, which does not work.

How to check

curl -sI https://example.com | grep -i x-powered-by

Expected

(empty: the header is gone)

Test an address that PHP generates, not an image or a CSS file: static files never carry this header anyway.

What can break

  • php_flag expose_php off in .htaccess: our test Apache without mod_php answered 500 (“Invalid command 'php_flag'”). With mod_php the line would not help either, because this setting can be changed in php.ini only.
  • ini_set('expose_php', '0') in code does nothing: the call returned false and the header stayed.
  • A single Apache Header unset line without always fails silently with PHP-FPM: no error, and the header is still there. Always check with the command below after the change.

Possible values

PHP is not the only sender. The last two rows come from the vendors' documentation; we did not test them.

SenderWhyWhere to switch it off
PHPexpose_php is on by defaultphp.ini: expose_php = Off
Express (Node.js)The header is sent by defaultIn the application code: app.disable('x-powered-by')
IISX-Powered-By: ASP.NET is in the default customHeaders listweb.config, the remove child of customHeaders

Sources

Next