How to hide php code

王林
Release: 2023-03-07 07:44:01
Original
3248 people have browsed it

Method to hide php code: You can choose to use an unknown extension as the extension of php to make php look like an unknown file type, such as [AddType application/x-httpd-php .bop .foo. 133t].

How to hide php code

# 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, and doing so can make it more difficult for attackers to discover system weaknesses. Setting expose_php = off in the php.ini file reduces the useful information they can obtain.

(Recommended tutorial: php video tutorial)

Another strategy is to let the web server use PHP to parse different extensions. Whether through .htaccess files or Apache configuration files, it is possible to 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 simply hide it completely:

(Related learning recommendations:java video tutorial )

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 and will be Add some burden to the server:

Example 3: Use HTML to make PHP file 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 recommendations: php training

The above is the detailed content of How to hide php code. For more information, please follow other related articles on the PHP Chinese website!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!