Home >Backend Development >PHP Problem >How to set php not to display version information

How to set php not to display version information

藏色散人
藏色散人Original
2022-01-27 09:18:472416browse

How to set php to not display version information: 1. Find the php.ini file; 2. Change the default "expose_php = On" to "expose_php = Off"; 3. Restart apache.

How to set php not to display version information

The operating environment of this article: Windows 7 system, PHP version 5.6, DELL G3 computer

PHP hidden version number tutorial

PHP itself does not enable the monitoring service, so the prevention scanner scans and determines the vulnerability through the version number. What we want to hide is the version number in the http header, not the version number in the system command line.

1. Check the current php version number

Access any page in the current service and intercept the response packet

2. Positioning php.ini file

locate php.ini

3. View the current configuration file used by PHP [Optional]

It should be said that the configuration file used by PHP is generally /etc /php.ini, but it is not necessarily so it can be further confirmed.

php -i | grep php.ini

Perhaps the most authoritative page to visit the classic phpinfo.php

4. Hide version number and restart apache (if you use other http servers, restart them in their respective ways)

Edit the found configuration file and change the default expose_php = On to expose_php = Off

service httpd restart

5. Cut the packet again and check that there is no X-Powered-By header

Recommended learning: "PHP Video Tutorial

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

Statement:
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