tags:

views:

100

answers:

2

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
A: 

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.

Jonathan Allen
Ah the dreaded short-tags. As long as you found the problem.
Anthony Forloney
+2  A: 

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 (i.e. <?) 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...)

Pascal MARTIN
Thanks for the explaination and the warning.
Jonathan Allen
You're welcome :-)
Pascal MARTIN