Hide PHP Script Extensions

Source: Internet
Author: User
Generally speaking, improving safety by means of concealment is considered a less useful practice. But in some cases, it is worthwhile to add as much security as possible.

Some simple ways to help hide PHP can make it more difficult for attackers to find weaknesses in the system. Setting expose_php = off in the php.ini file reduces the useful information they can get.

Another strategy is to have the Web server parse different extensions with PHP. Whether you are using a. htaccess file or an Apache configuration file, you can set the file name extension that can mislead the attacker:

Example #1 to hide PHP as another language

# make PHP look like other programming languages AddType application/x-httpd-php. asp. py. pl

Or simply hide it completely:

Example #2 Use an unknown extension as the extension of PHP

# make PHP look like an unknown file type AddType application/x-httpd-php. Bop. Foo. 133t

or hide it as an HTML page so that all the HTML files are going through the PHP engine, adding a load to the server:

Example #3 PHP file suffix with HTML

# make the PHP code look like an HTML page AddType application/x-httpd-php. htm. html

For this method to take effect, you must change the extension of the PHP file to the extension above. This improves security by hiding, albeit with a low defensive capability and a few drawbacks.

  • 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.