Internet Information Services (IIS) on Windows XP:At the end of this tutorial you should be able to install and configure the basic options in IIS, PHP and MySQL,
And this will allows you to run your local host server, so get ready
Installing IIS:Go to control panel

Open [Add or Remove programs]

Open [Add/Remove Windows Component]

Click to Check the [Internet Information Services (IIS)] then Click [Details] and make sure that all component are checked off
Note:You don’t really need to check [File Transfer Protocol (FTP) Service] and [Frontpage 2000 Server Extensions].
Click [OK].
Click [Next] on Windows Component Wizard, (You may need to insert Windows XP CD in the CD-ROM Driver, and wait for installation process.

Click [Finish].
Now go and explore the Drive (C:) or whatever your system drive is.
You should see folder named Inepub open it, locate the folder wwwroot and open it too, and this is where you have to place all your web pages.
Testing IIS:Bring up your favorite Text Editor (notepad, nodepad2 or whatever)
Type something like “Hello World” then save the file to c:\Inetpub\wwwroot\ and name it index.html
Open your internet explorer and type in the address bar localhost/index.php then hit [Enter] key.

Ok our Local Server is working good, If you got any error message that means the IIS installation failed somewhere and you must to reinstall it again.
Now let’s go and configure some IIS properties.
Configuring IIS:Go to [Start Menu], Click [Run] and type: inetmgr then hit [Enter] key.
Or
Go to Control Panel, Open [Administrative Tools], Open [Internet Information Services].
That’s will open the Internet Information Services Manager.

Right-Click on [Default Web Sites], Choose [Properties], the Properties dialog box will appears, Click [Home Directory] Tab.

As you can see above you can change the localhost path to anywhere you want by changing [Local Path]’s value
So whatever the path you typed in [Local Path] field you should have your web site placed there.
Now let’s configure the default Document.
The Default document is the Document that should load if you didn’t specify one when you typed a web site address in the address bar.
When we tested our IIS we created simple html file which was index.html,
And then when we tried the Local host we added this file name after the localhost/ to become localhost/index.php
Now what if we want to load any document named index.html automatically?(that’s what Default Document means)
To do that, click the [Documents] Tab.

Make sure the [Enable Default Document] is checked.
If you didn’t see “index.html” in the Default Documents box; Click [Add], Type index.html in text box, Click [OK].
Use [up] and [down] arrows to move “index.htm” to the top of the documents list, Click [OK].
Open your Internet explorer, type localhost in the address bar and hit [Enter] key
The index.html will be loaded automatically without the need to typing its name.
If we have two or more documents with a default document names such as (index.html, index.php, Default.htm,…) at the same directory,
The Document that will be loaded automatically is the one that came first in the default Documents list.
Installing PHP:Go to
http://php.netClick [Download].
Under windows Binaries Section, Click on [PHP 5.x.x] zip package (Make sure it’s php 5 or higher.
Select [download mirror], it will take a few minutes depending on you connection’s speed.
After downloading completed, create a directory on your C: drive or whatever you want and name it php for example.
Now extract the php zip file to c:\php\
Go to the extraction folder which is c:\php and search for “php.ini-recommended” or “php.ini-dist”.
Configuring php.ini:Here we will configure the distribution version php.ini-dist”;
Open it with any text editor.
Do a quick search for “doc_root” and edit it to point to our Local host directory path:
CODE
doc_root = c:\Inetpub\wwwroot
Now let’s configure the Sessions saving directory (This step is optional if you don’t want to use sessions)
Go to c:\Inetpub\wwwroot\ , create a new folder and name it “session”
At the php.ini-dist that is already opened do another search for “session.save_path”
Remove the semicolon ( ; ) from the beginning of the line, and edit the path to point to session directory you created before.
CODE
session.save_path = “c:/Inetpub/wwwroot/session”
Search for “extension_dir” and change the path to point to the ext directory which is placed in the php directory
CODE
extension_dir = “c:/php/ext”
After that we will uncomment some useful extension such as (php_mysql.dll) by removing the semicolon from the beginning of line
CODE
extension = php_mysql.dll
We can uncomment all extensions we need.
Let’s save the file as php.ini to the folder c:\php\
Note:The default path that Windows search for php.ini file is c:\windows\, so let’s make sure to copy php.ini file to windows folder.
All what we need now is to add php directory to windows paths.
To do that, right-click on [My Computer] icon, Choose [properties], Click [Advanced] Tab.

Click [Environment Variables].
We need to add php folder Path To windows Variables (User Variables and System Variables)

For User Variables click [New] and type PHPRC in the [Variable name] field, c:\php\ in the Variable Value field then hit [Ok].
For System Variable click on [Path] Variable, click [Edit], at the end of [Variable Value] field add a semicolon ( ; ) and the path to php folder “c:\php\”, hit [Ok]..
Hit [Ok] again on Environment Variables dialog box
Configuring IIS to work with php:Let's open IIS Manager again (Start => Run => type inetmgr, Hit [Ener] Key)
Navigate to [Default Web Site], Right click on it, Choose Properties, Click [Home Directory]

Under Application Setting section, Click Configuration.

Here we will point the IIS to php execution DLL File (php5isapi.dll) which is found in php folder.
And this is what we call Application Mapping; So IIS will execute .php files using that php5isapi.dll.
To do this click [Add]

In [Executable] field type the path to php5isapi.dll file or Brows to it.
In [Extension] field type .php
You can limit php execution Verbs if you select Limit to option and then type what you want php to allows such as (GET,HEAD,POST,TRACE)
You should separate the verbs by comma (,)
Click [Ok], you should see now php Extension, Path and Verbs in Application mapping list
Click [Ok].
Now, go back to IIS Manager, right click on your [Local Server] which has the same name of your computer.
Choose [All Tasks], [Restart IIS…].

Click [OK]
After Server restarting let's go check if we configured successfully.
Testing php on IIS:Open your favorite text editor
Type the following::
CODE
<?php
echo phpinfo();
?>
Save the file as (index.php) to your Server root path (c:\Inetpub\wwwroot\).
Open you Internet explorer,type localhost/index.php in the address bar and hit [Enter].
You should see the php version and php logo at the top and all other information about php.
IIS is configured correctly with php now.
If you didn't see that you should check out all the previous steps.
Ok php and IIS are ready to use with each others.
Installing Mysql:Go to
http://www.mysql.com/downloadsSearch for download link and click on it.
Select your operating system platform (here we use Windows)
Click on [pick up Mirror]
You may need to [Sing in] or to [Proceed with new user].
Click on your preferred Mirror and start downloading.
When downloading done
Double click the downloaded file; you'll see the Welcome Screen, click [Next].
Here we can choose the Setup type, you can choose [Typical] for general use but I'll choose [Complete], there are a lot of useful things bundled with Mysql such as (Command Line Shell).

Click [Next], Setup wizard now will show you your setup settings, click [Install].
Wait until setup progress bar completed,click [Next],[Next]
Make sure that [Configuerthe Mysql Server now] checked of and click [Finish].
Mysql Configuration wizard shows up.

If this is your first time you are installing Mysql Choose [Standard Confoguration].
Otherwise you can choose [Detailed Configuration] then choose the best option that describes your machine.
Click [Next].
Now the wizard will let you configure some windows options.
It's recommended that you run Mysql as a Windows Service, so make sure it's checked.
And you have to decide if you want to launch Mysql Server automatically.
If you want to called mysql from command line you have to check [Include Bin Directory in Windows Path]
We do something like that before when we add the php directory path to Windows variables,this time the setup wizard will do the job for us.

Click [Next].
It's time now to adjust some security options.

Keep in mind that (root) is the default user name in Mysql and has all accessibility options, so type the root's password you want and confirm it.
If you are using Mysql on your local machine you don't need to check [Enable root access from remote machines].
And believe me you don't want to check [Create An Anonymous Accounts].
Click [Next], click [Execute].

Click [Finish]
Note:If the configuration processing failed in somewhere don't panic, Close all your opened program.
Go to [Start Menu],[MySQL],[ MySQL Server 5.0],[ MySQL Server Instance Config Wizard].
This will bring up MySQL Configuration Wizard again, follow the Configuration Wizard Steps.
Testing MySQL:1-If you selected complete setup option follow these steps:
Goto [Start Menu], ],[MySQL],[ MySQL Server 5.0],[ MySQL Command Line Client].
2-If you didn't select the complete option, open your command prompt by clicking on [Start Menu], [Run], type (cmd) and hit [Enter] Key.
At command prompt type this:
CODE
c:
cd\
cd C:\Program Files\MySQL\MySQL Server 5.0\bin
Now we are on MySQLdirectory,and the command prompt looks like (C:\Program Files\MySQL\MySQL Server 5.0\bin>)
Type this:
CODE
mysql –u root -p
The above code will pass root as user name to MySQL and prompt us for password.
In the both ways (1, 2) MySQL Command Line Window will shows up and prompt us for the root's password,
Type your root's password and hit [Enter] Key.

If you see the above screen, that's means MySQL is working good.
Try to type this:
CODE
show databases;
This will show you all available data bases in MySQL data folder (C:\Program Files\MySQL\MySQL Server 5.0\data\)

Type quit closing MySQL Command Line Window.
Testing php with MySQL:If you didn't still have the index.php file in your wwwroot folder,Create another one there.
Type localhost/index.php in Internet Explorer address bar and hit [Enter] Key.
Search the page; you should see something like this:
Note:If you didn't see that make sure that you have file named (libmysql.dll) in php directory.
And/or you may forgot to copy (php.ini) file from php directory to the Windows directory as we mentioned at configuring php.ini file section,
And/or you forgot to uncomment extension = php_mysql.dll in php.ini file.
Try to restart your local server [Start Menu], [Run], type (inetmgr), Hit [Enter] Key,
Right click on your [Local Server] which has the same name of your computer, Choose [All Tasks], [Restart IIS…].[Ok]
Now it's your turn, so take your time and go play around PHP and MySQL
I hope this can help someone.
If you find that there are errors or that I missed something, please feel free to correct me.
Good luck