是什么的.htaccess与线AddHandler的PHP5脚本.PHP吗? [英] what does .htaccess with line AddHandler php5-script .php do?

查看:573
本文介绍了是什么的.htaccess与线AddHandler的PHP5脚本.PHP吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用新的虚拟主机。我创建的每个域的的public_html文件夹是一个.htaccess具有以下行自动生成的:

I am with new web host. The public_html folder of each domain I create is auto generated with an .htaccess that has the following line:

AddHandler php5-script .php

这是什么呢?

What is this for?

推荐答案

这只是指示PHP通过它们传递到PHP5间$ p来处理在的.php 结尾的文件$ PTER。没有替代该配置中,web服务器可以提供文件服务的最终用户的web浏览器作为原料的PHP code,而不是执行code。这就提出了将数据库登录凭据或或其他秘密的危险可能性。

This just instructs PHP to handle files ending in .php by passing them to the PHP5 interpreter. Without this configuration in place, the web server may serve the files to the end-user's web browser as raw PHP code, rather than executing the code. That raises the dangerous possibility of exposing database login credentials or, or other secrets.

使用相同的机制,您可以配置Web服务器除了的.php 来解析与其他扩展名的文件作为PHP脚本并把他们给PHP跨preTER 。这是偶尔做被命名它们与的.html 扩展名,例如掩盖PHP脚本。

Using the same mechanism, you could configure the web server to parse files with other extensions besides .php as PHP scripts and hand them to the PHP interpreter. This is occasionally done to mask PHP scripts by naming them with .html extensions, for example.

# Interpret both .php & .html as PHP:
AddHandler php5-script .php .html

这篇关于是什么的.htaccess与线AddHandler的PHP5脚本.PHP吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆