How to set php not to display version information

藏色散人
Release: 2023-03-15 06:38:01
Original
2359 people have browsed it

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

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

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

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!

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!