Home > Backend Development > PHP Tutorial > hide php script extension

hide php script extension

伊谢尔伦
Release: 2016-11-22 10:38:47
Original
1434 people have browsed it

Generally speaking, improving security through hidden means is considered to be of little effect. But in some cases, adding as much security as possible is worth it.

Some simple methods can help hide PHP, which can make it more difficult for attackers to discover system weaknesses. Setting expose_php = off in the php.ini file reduces the amount of useful information they can obtain.

Another strategy is to let the web server parse different extensions using PHP. Whether through .htaccess files or Apache configuration files, you can set file extensions that can mislead attackers:

Example #1 Hide PHP as another language

# 使PHP看上去像其它的编程语言
AddType application/x-httpd-php .asp .py .pl
Copy after login

Or hide it completely:

Example # 2 Use an unknown extension as the PHP extension

# 使 PHP 看上去像未知的文件类型
AddType application/x-httpd-php .bop .foo .133t
Copy after login

or hide it as an HTML page, so that all HTML files will pass through the PHP engine, which will add some burden to the server:

Example #3 Use HTML to make PHP files Suffix

# 使 PHP 代码看上去像 HTML 页面
AddType application/x-httpd-php .htm .html
Copy after login

For this method to take effect, the extension of the PHP file must be changed to the above extension. This improves security through concealment, although defense capabilities are low and have some drawbacks.


Related labels:
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