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
+12.5k Golang : Convert spaces to tabs and back to spaces example
+9.7k Golang : Get UDP client IP address and differentiate clients by port number
+5k Golang : List all packages and search for certain package
+4.5k Swift : Convert string array to array example
+11.1k Golang : Encrypt and decrypt data with x509 crypto
+4.7k Golang : ROT32768 (rotate by 0x80) UTF-8 strings example
+6.1k Web : How to see your website from different countries?
+4.2k Unix/Linux : secure copying between servers with SCP command examples
+7.5k PHP : How to parse ElasticSearch JSON ?
+10.2k CodeIgniter : How to check if a session exist in PHP?
+9.7k Golang : Replace a parameter's value inside a configuration file example