Monday, 21 July 2014



Most of the developers who usually develop both ASP.net and PHP web applications are facing the following problems.
  1. How to Setup IIS on windows 7
  2. How to Run both ASP.net & PHP on the same IIS server. 
  3. How to configure IIS for PHP 
  4. How to run PhpMyAdmin on IIS Server.
In this tutorial we will cover all the above topics. So go through the tutorial step by step.

Step 1: IIS is not installed by default on Windows 7 (that's left for the programmers). As a result you have to manually set up IIS in your machine. You can use the Microsoft® Web Platform Installer (Web PI) to easily install Internet Information Services (IIS) and applications that run on IIS. To learn more about the Web PI, see Learn about and install theWeb PI.
Now this article deals with the manual set up of IIS.
Follow the steps => Start -> Control Panel -> Program and features -> Turn Windows Feature on or off.


Before you begin, first ensure whether your Windows 7 supports IIS or not. Here is the list of featuressupported by different versions of Windows 7.
By default, you do not have administrative user rights if you are logged on as a user other than the built-in administrator, even if you were added to the Local Administrators group on the computer (this is a new security feature in Windows Server® 2008 called Local User Administrator). Log on either to the built-in administrator account, or explicitly invoke applications as the built-in administrator by using the runas command-line tool.

Step 2: Now, simply click on the features that are checked on the following screens and then hit the OK button.







Step 3: A progress bar will appear.



Step 4: Once the installation is over, to confirm it, simply type the following URL into your browser: http://localhost.
If installation is successful, then you will see the following screen:




Step 5: Now you can use Internet Information Services Manager to manage and configure IIS. To open IIS Manager, click Start, type inetmgr in the Search Programs and Files box, and then press Enter.





Step 6: Up to step 5 we have installed IIS on our computer. Now we have to configure php on our IIS so that we can run both ASP.NET and PHP website on the same server. The easiest way for that is to install Web Plateform Installer. You can download it from here. http://www.microsoft.com/web/downloads/platform.aspx

Step 7: After downloading Web Plateform Installer. Install wpilauncher. Installation Screen is:



Step 8: After Successful installation of Web Plateform Installer. You will get this Screen.   



Step 9: Close the Web Plateform Installer. And Open IIS Manager. Click Start, type inetmgr in the Search Programs and Files box, and then press Enter.
Here you will get the Web Plateform Installer. As shown in the figure.


Step 10: In order to configure PHP follow the Steps => Double Click on Web platform Installer Icon -> Select Products from the Tab -> Select Frameworks from left menu -> you will find PHP 5.4.24 with other version -> Click its Add button which version you want (I will recommended PHP5.4.24 version) -> finally click on Install 



It will take several minutes to download and Install.

Step 11: Once Installation is finished. Restart the IIS from IIS Manager. Go to the path “C:\inetpub\wwwroot”

Step 12: Now we will test our server is configured for both ASP.NET and PHP. Next Create a folder “phpinfo”

Step 13: Create a index.php file in phpinfo folder and write the following Code.

<?php phpinfo(); ?>

Step 14: Type the following URL into your browser: http://localhost/phpinfo


Now this page is showing that PHP is running successfully on your IIS server instead of apache so there is no need to install XAMPP or WAMP server separately to run PHP on windows PC.


Similarly you can create an index.aspx file using notepad and type the following code.


<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<% Response.Write("Hello World From ASP.Net"); %>
</body>
</html>

Now Type the URL: http://localhost/phpinfo/index.aspx

Now this page is showing that ASP.Net is running successfully on your IIS server.



Step 15: Since PHP is compatible with MySql So you can install MySQL also with Web Platform Installer and its steps is similar to Step 10. In order to install MySql follow the Steps => Double Click on Web platform Installer Icon -> Select Products from the Tab -> Select database from left menu -> you will find MySQL Windows 5.1 -> Click its Add button -> finally click on Install. Once it will start to install it will ask a password for MySQL which is mandatory so put an easy password for your MySQL.

Step 16: In this step we will install PhpMyAdmin on IIS Server to operate MySQL databases. First we have to download PhpMyAdmin. Go to the Url : http://www.phpmyadmin.net/home_page/downloads.php and download that version of PhpMyAdmin which is compatible with MySQL 5.1. I will recommended to download PhpMyAdmin 4.2.2 and It can be download directly from here http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.2.2/phpMyAdmin-4.2.2-all-languages.zip/download
 
Step 17: Once download is completed. Extract the file and rename it from “phpMyAdmin-4.2.2-all-languages” to phpMyAdmin. Now copy phpMyAdmin Folder and paste it to IIS default webroot folder. As shown in figure.







Step 18: Now Restart IIS from IIS Manager.



Step 19: Open your browser and type the URL: http://localhost/phpmyadmin


Step 20: Default user name is root. And type your password which given in Step 15. After Login What you will see that it is running on Microsoft-IIS/7.5. As shown in figure.


 
Hence what we have learnt in this tutorial.

  1.  How to SET UP IIS on windows 7
  2.  How to Run both ASP.net & PHP on the same IIS server.
  3.  How to configure IIS for PHP
  4.  How to run PhpMyAdmin on IIS Server.


Thanking You!
Categories: