Home > Article > Backend Development > How to hide version in php
How to hide the version of php: 1. Check the current php version number; 2. Locate the "php.ini" file; 3. Check the configuration file currently used by PHP; 4. Hide the version number and restart apache.
PHP hidden version number
PHP itself does not enable the listening service, so prevent scanner scanning To determine 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. Locate the 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
Probably the most authoritative page to visit the classic phpinfo.php
4. Hide the version number and restart apache (if you use other http servers, restart them in their own corresponding ways)
Edit the found configuration file and set the default expose_php = On Modify to expose_php = Off
##
service httpd restart5. Cut the package again to check that there is no X-Powered-By header Recommended: "
PHP Tutorial"
The above is the detailed content of How to hide version in php. For more information, please follow other related articles on the PHP Chinese website!