HostOnNet Blog

Hide X-Powered-By: PHP

Looking for Linux Server Admin or WordPress Expert? We can help.

On a web site, HTTP headers show PHP version like X-Powered-By: PHP/5.1.6

[root@server12 ~]#  curl -I http://netfree.netfreehost.com
HTTP/1.1 200 OK
Server: nginx/1.1.0
Date: Sun, 11 Sep 2011 20:00:40 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.1.6
Cache-Control: no-cache, pre-check=0, post-check=0
Expires: 0
Pragma: no-cache
[root@server12 ~]#

To disable PHP version showing in header, edit /etc/php.ini

vi /etc/php.ini

Set expose_php to off

expose_php=Off

Now restart web server.

After restarting, Http headers stopped showing X-Powered-By: PHP/5.1.6

[root@server12 ~]#  curl -I http://netfree.netfreehost.com
HTTP/1.1 200 OK
Server: nginx/1.1.0
Date: Sun, 11 Sep 2011 20:04:41 GMT
Content-Type: text/html
Connection: keep-alive
Cache-Control: no-cache, pre-check=0, post-check=0
Expires: 0
Pragma: no-cache

[root@server12 ~]#

Posted in PHP

One Response to Hide X-Powered-By: PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.