Home >Backend Development >PHP Problem >How to set php not to display version information
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.
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!