Home  >  Article  >  Backend Development  >  How to hide the php version information of the website

How to hide the php version information of the website

藏色散人
藏色散人forward
2020-01-09 14:19:042826browse

After we put the website online, we can display the header information of the specified website through the following curl command.

For example:

How to hide the php version information of the website

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

How to hide the php version information of the website

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!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete