配置Apache和PHP全部大写的文件扩展名来执行PHP脚本 [英] Configure Apache to execute PHP scripts with PHP all uppercase filename extension

查看:453
本文介绍了配置Apache和PHP全部大写的文件扩展名来执行PHP脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个文件

一个是 list.php的(PHP小写)

<html>
<body>
    <b> 0 or 1 </b><br><pre>
    <?php 

        if(1 > 0){
            echo "1";

        }
        else
        {
          echo "0";
        }

    ?></pre>
</body>
</html>

当我运行该文件,我得到0。

When I run the file I get 0.

但另一个文件是 list.php的(PHP大写字母),当我运行它,我得到了code作为文本!

But another file is list.PHP (PHP in uppercase) and when I run it I get the code as text!

我试过设置所有的AllowOverride 在Apache中,但仍然有同样的问题。

I tried setting AllowOverride all in apache but still have the same problem.

推荐答案

在Apache的配置文件httpd.conf,查找下面一行:

In the configuration file httpd.conf of Apache, look for the following line:

AddType application/x-httpd-php .php 

添加其他行说:

AddType application/x-httpd-php .PHP

的变化需要重新启动Apache后台程序。

The changes require you to restart the Apache daemon.

这篇关于配置Apache和PHP全部大写的文件扩展名来执行PHP脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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