为什么显示为纯文本我的PHP文件? [英] why are my php files showing as plain text?
问题描述
我已经写使用PHP在WAMP一段时间的PHP应用程序。现在,我在安装PHP和放大器;阿帕奇分开我的工作电脑上。我已经安装了PHP 5,以及最新的Apache。我去到本地主机,看看它的作品!现在我添加一个名为test.php的文件,该文件显示:
I've been writing php apps using php for a while in wamp. Now I'm installing PHP & apache separately on my work PC. I've installed PHP 5, and the latest apache. I go to localhost and see it works! now I add a file called test.php which displays:
<?php
phpinfo();
?>
但在浏览器中它只是显示纯文本。有没有什么地方我已明确告诉它使用PHP5?
but in the browser it just displays plain text. Is there somewhere I have explicitly tell it to use PHP5?
非常感谢
推荐答案
您将需要添加到您的服务器配置:
You'll need to add this to your server configuration:
AddType application/x-httpd-php .php
这是假设你已经正确安装了PHP,这可能并非如此,因为它不工作,它通常会在安装后立即启动。
that is assuming you have installed php properly, which may not be the case since it doesn't work where it normally would immediately after installing.
这是完全可能的,你也可以选择使用的LoadModule
指令的PHP这么/ DLL添加到您的Apache配置(通常在 httpd.conf文件
)
It is entirely possible that you'll also have to add the php so/dll to your apache config using a LoadModule
directive (usually in httpd.conf
)
这篇关于为什么显示为纯文本我的PHP文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!