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 : Human readable time elapsed format such as 5 days ago
+14.2k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+20.4k Golang : Convert seconds to minutes and remainder seconds
+6k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+4.4k Golang : Return multiple values from function
+8.1k Random number generation with crypto/rand in Go
+32.8k Golang : How to stream file to client(browser) or write to http.ResponseWriter?
+9.1k Golang : Get login name from environment and prompt for password
+28.9k Golang : Generate random string
+4.4k Unix/Linux/MacOSx : How to remove an environment variable ?
+6.3k Golang : Check to see if *File is a file or directory