Home > Backend Development > PHP Problem > How to hide php version

How to hide php version

藏色散人
Release: 2023-02-28 19:24:01
Original
2390 people have browsed it

How to hide php version

How to hide the PHP version

Effectively hide the PHP version information and reduce the risk of the 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 the php version information of the current address It is 5.6.22

You can check the php.ini path through the command. The php.ini path here is /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

/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

For more related tutorials, please pay attention to php Chinese website.

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

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