After we put the website online, we can display the header information of the specified website through the following curl command.
For example:
At this time you can see the following information
X-Powered-By: PHP/7.0.21
So we can see that we can see the php used by the website Version information, is this unsafe? So how do we get the version information of PHP?
At this time we need to modify the php configuration file php.ini
1: Find the path to the php.ini file
Execute the following command to find the path to php.ini
php -i | grep php.ini
So we can find the path to php.ini
2: Modify the php.ini configuration file
After finding the php.ini file , check to see if there is the following information
expose_php = On
If it is not added directly, if there is, modify it on the basis
expose_php = Off
3: Restart php-fpm
/etc/init.d/php-fpm restart
After restarting, when you use the curl command to display the header information, you can find that the PHP version information of our website has been hidden.
For more PHP related knowledge, please visit PHP Tutorial !
The above is the detailed content of How to hide the php version information of the website. For more information, please follow other related articles on the PHP Chinese website!