PHP : Hide PHP version information from curl
By default, PHP will expose its version information when query by curl -I
and you may want to hide the version information to prevent a potential attacker from gaining more information.
For example:
localhost:~ admin$ curl -I https://www.socketloop.com
HTTP/1.1 200 OK
Server: nginx/1.4.6
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.25
<------ hereAccess-Control-Allow-Credentials: true
Date: Thu, 14 Aug 2014 12:21:40 GMT
Cache-Control: max-age=0, no-cache
To turn off the version information. Do the following on the webserver's PHP configuration :
vi /etc/php.ini
look for expose_php = On
line
change it to expose_php = Off
and this will cause PHP not to send over the version information when queried.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+6.6k Grep : How to grep for strings inside binary data
+12.5k Golang : How to check if a string starts or ends with certain characters or words?
+4.5k Golang : Valued expressions and functions example
+11.6k Golang : Handle API query by curl with Gorilla Queries example
+18.5k Golang : How to get hour, minute, second from time?
+12.2k Golang : Clean formatting/indenting or pretty print JSON result
+9.2k Golang : Handle sub domain with Gin
+14.9k Golang : Find commonalities in two slices or arrays example
+7.6k Golang : How to detect if a sentence ends with a punctuation?
+34.1k Golang : Proper way to set function argument default value
+20k Golang : Accept input from user with fmt.Scanf skipped white spaces and how to fix it
+14.7k Golang : Execute function at intervals or after some delay