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.