开发者

Fail to interpret PHP in Windows 7 Apache. Why?

I have follow every step of setting up apache & php in Windows 7.

I have the following set in the Httpd.conf:

LoadModule php5_module "C:/PHP/php5apache2_2.dll"


<IfModule mime_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .php
</IfModule>

PHPIniDir "C:/PHP/"

if it is .html, it displays no problem. (e.g. localhost/index.hmlt) if it 开发者_StackOverflow社区is .php, then it displays the source code (e.g. localhost/phpinfo.php in which phpinfo.php is:

I run the phpinfo.php in command line and there is no problem. it is the apache server that doesn't recognized PHP. so what may be wrong?


You are encasing the type code in the wrong module

<IfModule mime_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .php
</IfModule>

should be

<IfModule php5_module.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
</IfModule> 

most distributions will include a php config file that does this for you in the correct way

DC

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜