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
+10.2k Golang : Use regular expression to get all upper case or lower case characters example
+16.3k CodeIgniter/PHP : Create directory if does not exist example
+14.7k Golang : Get URI segments by number and assign as variable example
+15.8k Golang : Update database with GORM example
+7.5k Javascript : Push notifications to browser with Push.js
+17.2k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+8.8k Golang : GMail API create and send draft with simple upload attachment example
+4.7k PHP : Extract part of a string starting from the middle
+9.2k Golang : Generate random Chinese, Japanese, Korean and other runes
+6.2k PHP : How to handle URI or URL with non-ASCII characters such as Chinese/Japanese/Korean(CJK) ?