How to hide php version information

藏色散人
Release: 2023-04-07 21:44:02
forward
4076 people have browsed it

Effectively hide php version information and reduce the risk of website being attacked by hackers

Check whether the php version number is currently enabled

curl -I http://你的地址
Copy after login
Copy after login

X-Powered-By: PHP/5.6.22

Here you can see that the php version information of the current address is 5.6.22

You can check the php.ini path through the command. My php.ini path is in /usr/local/php/etc/ php.ini

php -i | grep php.ini
Copy after login
Configuration File (php.ini) Path => /usr/local/php/etc
Loaded Configuration File => /usr/local/php/etc/php.ini
Copy after login

Edit /usr/local/php/etc/php.ini

Find the expose_php parameter

Change expose_php = On to expose_php = Off, and then restart php can

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

Verification

curl -I http://你的地址
Copy after login
Copy after login

At this time the php version number has been hidden

Recommended: "PHP Tutorial"

The above is the detailed content of How to hide php version information. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:whsir.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