How PHP hides the header version output (x-powered-by) information

Source: Internet
Author: User
This article describes the method of hiding the version output x-powered-by of the PHP header under the reference of a friend who needs it.

In the PHP program, the default output header information: (status-line) http/1.1 okdate Wed, 02:30:46 gmtserver apache/2.2.13 (Win32) x-powere D-by:php/5.2.3content-length 30keep-alive timeout=5, max=100connection keep-alivecontent-type text/html

To avoid outputting the above version information, you can modify the php.ini expose_php to change the default on to OFF.

Hide and disguise Apache version, hide php head version, you can refer to the following methods.

1, added in Apache http.conf: Serversignature offservertokens Prod

Where serversignature off tells Apache to not display server version information on error pages (such as HTTP status 404), but this option does not affect pages that are normally accessible (HTTP status 200, and so on). Server version information is still available in the server header for normal access to the webpage.

Servertokens prod tells Apache to return only Apache in the server header (server header) and does not return version information for the server operating system and Apache.

2, Hide php header version php.iniexpose_php = off hidden PHP program head issued: x-powered-by:php/5.2.4 similar information

Set in the php.ini file: expose_php = off to avoid output: x-powered-by:php/5.2.4 version information.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.