Title: PHP on IIS Displaying php code instead of page
Tags: php;iis
Question: I installed PHP 5.3 on IIS (Windows Server 2008), followed the instructions on
http://php.net/manual/en/install.windows.iis7.php

when i am opening php pages now i get the php code instead of the processed page, why does it happens and how do i fix it?


Here is the accepted answer: If you are seeing your PHP source code in the browser, then it will be something like you are using PHP short tags in your code ```( <? instead of <?php )``` and you don't have the short_tags directive turned on in php.ini. 

The other possibility is your handler mapping is not correct?

Configure IIS to Handle PHP Requests

For IIS to host PHP applications, you must add a handler mapping that tells IIS to pass all PHP-specific requests to the PHP application framework by using the FastCGI protocol.
Configure IIS to handle PHP requests by using IIS Manager


Open IIS Manager. At the server level, double-click Handler Mappings.
In the Actions pane, click Add Module Mapping.... In the Add Module Mapping dialog box, specify the configuration settings as follows:
Request path: *.php
Module: FastCgiModule
Executable: "C:[Path to your PHP installation]\php-cgi.exe"
Name: PHP via FastCGI
Click OK.
In the Add Module Mapping confirmation dialog box that asks if you want to create a FastCGI application for this executable, click Yes.
Test that the handler mapping works correctly by creating a phpinfo.php file in the C:\inetpub\wwwroot folder that contains the following code:





Open a browser and navigate to //dns-or-ip-to-server/phpinfo.php. If everything was setup correctly, you will see the standard PHP information page.


NOTE: If you do not see FastCgiModule in the Modules: list, the module is either not registered or not enabled. To check if the FastCGI module is registered, open the IIS configuration file that is located at %windir%\windows\system32\config\applicationHost.config and check that the following line is present in the  section:


In the same file, also check that the FastCGI module is added to the  section:


Comment for this answer: looks like that! checking now
Comment for this answer: that was that! wasted a lot of time to figure what is the problem, thanks!


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:01/05/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<php><iis>', 'Title': 'PHP on IIS Displaying php code instead of page', 'ViewCount': 3494, 'id': 27787932, 'user_AboutMe': None, 'user_AccountId': 2714697.0, 'user_DisplayName': 'atikot', 'user_Reputation': 4491.0, 'user_Views': 97.0, 'user_id': 2363586.0}}