Apache显示PHP代码而不是执行它 [英] Apache shows PHP code instead of executing it

查看:382
本文介绍了Apache显示PHP代码而不是执行它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在尝试在计算机上安装PHP和Apache.几个小时后,它们就安装好了.我已经像大家一样修改了httpd.conf和php.ini文件.然后,我创建了一个简单的PHP脚本:

I have recently been trying to install PHP and Apache on my computer. After many hours, they're installed. I have modified the httpd.conf and php.ini files like everyone says. I then created a simple PHP script:

<?php phpinfo(); ?>

但是当我尝试使用http://127.0.0.1/phpinfo.php运行它时,它只是显示源代码而不是执行它.我正在使用Apache 2,PHP 5和Windows Vista.

But when I try to run it with http://127.0.0.1/phpinfo.php it just shows the source code instead of executing it. I am using Apache 2, PHP 5 and Windows Vista.

编辑的行:

PHP.INI:

short_open_tag = On

HTTPD.CONF

HTTPD.CONF

LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir "C:/php"

推荐答案

您必须启用php!检查Apache目录中的文件夹mods-enabled(默认值:/etc/apache2/),以查看是否找到名为php的文件.我不记得扩展名,但我认为它是.so.

You must enable php! Check the folder mods-enabled in the Apache directory (default: /etc/apache2/) to see if you find a file named php. I don't remember the extension but I think it's .so.

还请检查/var/log/apache2/error.log来查看是否还有其他错误.

Also check in /var/log/apache2/error.log to see if you have any other errors.

这篇关于Apache显示PHP代码而不是执行它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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