How to hide PHP version in Linux server

  
 

The web server avoids some unnecessary troubles. You can not display the version information of apache and php. How to hide the PHP
version in the Linux server? Let's learn the Xiaobian to share the Linux server. Hide the PHP
version of the method, I hope to help everyone.

Hide PHP version method in Linux server

By default, expose_php is enabled by default. Turning off the “expose_php” parameter allows php to hide its version information.

[root@centos66 ~]# vi /etc/php.ini

In your php.ini, locate the line containing expose_php and set On to Off:

expose_php = Off

Prior to this, the web server header looked like this:

[root@centos66 ~]# curl -I http://www.ehowstuff.com/HTTP/1.1 200 OK Server: nginx Content-Type: text/html; charset=UTF-8 Vary: Accept-Encoding X-Powered-By: PHP/5.3.3 X-Pingback: http://www.ehowstuff.com /xmlrpc.php Date: Wed, 11 Feb 2015 14:10:43 GMT X-Page-Speed: 1.9.32.2-4321 Cache-Control: max-age=0, no-cache

Change and restart After the web service, php will not display the version in the web service header:

HTTP/1.1 200 OK Server: nginx Date: Wed, 11 Feb 2015 15:38:14 GMT Content-Type: text/Html; charset=UTF-8 Vary: Accept-Encoding X-Pingback: http://www.ehowstuff.com/xmlrpc.php Date: Wed, 11 Feb 2015 14:10:43 GMT X-Page-Speed: 1.9. 32.2-4321 Cache-Control: max-age=0, no-cache

LCTT Annotation: In addition to the version of PHP, the web server Default leaked version number. If you are using an Apache server, please refer to this article to turn off the Apache version display; if you are using an Nginx server, add server_tokens off; in the http section; Please remember to restart the related services.

Copyright © Windows knowledge All Rights Reserved