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
+3.9k Golang : Generate Interleaved 2 inch by 5 inch barcode
+7.8k Golang : Copy map(hash table) example
+10.8k Golang : Handle or parse date string with Z suffix(RFC3339) example
+8.7k Golang : Create matrix with Gonum Matrix package example
+7.4k Golang : Go as a script or running go with shebang/hashbang style
+4.8k Golang : Extract sub-strings
+6.1k Prevent Write failed: Broken pipe problem during ssh session with screen command
+11.1k Golang : Calculate elapsed years or months since a date
+4.3k Golang : Error handling methods
+8.8k Golang : How to get quoted string into another string?
+8.9k Golang : Find age or leap age from date of birth example
+8.6k Golang : Meaning of omitempty in struct's field tag