How to hide the php version information of the website

藏色散人
Release: 2023-04-08 07:56:02
forward
2825 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

If it is not added directly, if there is, modify it on the basis

expose_php = Off
Copy after login

3: Restart php-fpm

/etc/init.d/php-fpm restart
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template