简体   繁体   中英

PHP not working under IIS on WIndows 7

I recently installed PHP on IIS/Windows 7, but it isn't working. 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

  • Request Path: *.php
  • Modue: FastCgiModule
  • Executable: 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 <? . In IIS the block must start with <?php .


That's not a setting of 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.

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.

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 <?


Enabling short_open_tag is just a matter of editing your php.ini file, and using

short_open_tag = On

Instead of

short_open_tag = Off

No need to edit/path all your PHP files ;-)
(Well, if you are admin of your server, that is...)

In some PHP hosts you can being a script block with <? . In IIS the block must start with <?php .

Needless to say, I'm going to be spending the resst of the day fixing all the script files I inherited.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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