简体   繁体   English

PHP在Windows 7的IIS下无法正常工作

[英]PHP not working under IIS on WIndows 7

I recently installed PHP on IIS/Windows 7, but it isn't working. 我最近在IIS / Windows 7上安装了PHP,但无法正常工作。 I am getting the entire source file in the browser window. 我正在浏览器窗口中获取整个源文件。

FastCGI Settings shows c:\\Program Files (x86)\\PHP\\php-cgi.exe Handler Mappings has FastCGI设置显示c:\\ Program Files(x86)\\ PHP \\ php-cgi.exe处理程序映射具有

  • Request Path: *.php 请求路径:*。php
  • Modue: FastCgiModule 型号:FastCgiModule
  • Executable: C:\\Program Files (x86)\\PHP\\php-cgi.exe 可执行文件:C:\\ Program Files(x86)\\ PHP \\ php-cgi.exe
  • Request Restrictions: File or Folder, All verbs, Script Access 请求限制:文件或文件夹,所有动词,脚本访问

To answer the answer you gave one hour ago, which said (quoting) : 要回答您一个小时前给出的答案,该答案说(引用)

In some PHP hosts you can being a script block with <? 在某些PHP主机中,您可以使用<?作为脚本块<? . In IIS the block must start with <?php . 在IIS中,该块必须以<?php开头。


That's not a setting of IIS ; 那不是IIS的设置; that's a configuration option of PHP , which is called short_open_tag : if that configuration option is enabled, short tags (ie <? ) will be accepted. 这是PHP的配置选项,称为short_open_tag :如果启用了该配置选项,则将接受短标记(即<?

Using short open tags is often not considered as a good pratice, as they can be disabled -- and they are, by default, with recent versions of PHP -- but, if you are admin of your server, you should be able to re-enable them. 使用短打开标签通常不被认为是一个很好的实践,因为可以禁用它们-默认情况下,它们是PHP的最新版本-但是,如果您是服务器的管理员,则应该能够-启用它们。

And, for information, they are also considered as " bad " because they can cause problem with XML files, which start with <?xml -- if short_open_tag is enabled, this will cause troubles, as it starts with <? 并且,作为信息,它们也被认为是“ 不好的 ”,因为它们会导致以<?xml开头的XML文件出现问题-如果启用short_open_tag ,则将引起麻烦,因为它以<?开头<?


Enabling short_open_tag is just a matter of editing your php.ini file, and using 启用short_open_tag只是编辑php.ini文件并使用

short_open_tag = On

Instead of 代替

short_open_tag = Off

No need to edit/path all your PHP files ;-) 无需编辑/路径所有PHP文件;-)
(Well, if you are admin of your server, that is...) (好吧,如果您是服务器的管理员,那就是...)

In some PHP hosts you can being a script block with <? 在某些PHP主机中,您可以使用<?作为脚本块<? . In IIS the block must start with <?php . 在IIS中,该块必须以<?php开头。

Needless to say, I'm going to be spending the resst of the day fixing all the script files I inherited. 不用说,我将花费一天的时间来修复我继承的所有脚本文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM