Page 1 of 1

Installing and configuration IIS+PHP+MySQL Learn step by step about how to install and configure IIS as Local hos Rate Topic: ***** 1 Votes

#1 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Post icon  Posted 18 December 2007 - 05:14 PM

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
Attached Image

Open [Add or Remove programs]
Attached Image
Open [Add/Remove Windows Component]
Attached Image

Click to Check the [Internet Information Services (IIS)] then Click [Details] and make sure that all component are checked off
Attached Image

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.
Attached Image

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.
Attached Image

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.

Attached Image

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

Attached Image

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.

Attached Image

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.net
Click [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:
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.
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
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
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.

Attached Image

Click [Environment Variables].

We need to add php folder Path To windows Variables (User Variables and System Variables)

Attached Image

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]

Attached Image

Under Application Setting section, Click Configuration.

Attached Image

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]

Attached Image

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…].

Attached Image

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::
<?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/downloads
Search 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).

Attached Image

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.

Attached Image

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.

Attached Image

Click [Next].

It's time now to adjust some security options.

Attached Image

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].

Attached Image

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

Attached Image

If you see the above screen, that's means MySQL is working good.
Try to type this:
show databases;


This will show you all available data bases in MySQL data folder (C:\Program Files\MySQL\MySQL Server 5.0\data\)

Attached Image

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:

Attached Image

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

Is This A Good Question/Topic? 1
  • +

Replies To: Installing and configuration IIS+PHP+MySQL

#2 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Posted 22 December 2007 - 08:03 AM

:^:
The Screenshots are really helpful.
Was This Post Helpful? 0
  • +
  • -

#3 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Posted 22 December 2007 - 05:45 PM

Such an honor to hear that from you :D
Was This Post Helpful? 0
  • +
  • -

#4 mars1986  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-December 07

Posted 18 October 2008 - 11:42 PM

 thanks for the post bro...now I know how to install IIS

Was This Post Helpful? 0
  • +
  • -

#5 Elemental_1_1  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 114
  • Joined: 22-January 09

Posted 22 January 2009 - 11:30 PM

Geat tutorial! I have been looking for something like this for a while! Thanks again, you should get something for posting this!
Was This Post Helpful? 0
  • +
  • -

#6 kazi_SYD  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-June 09

Posted 23 June 2009 - 10:10 PM

View Postahmad_511, on 18 Dec, 2007 - 04:14 PM, said:

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
Attachment attachment

Open [Add or Remove programs]
Attachment attachment
Open [Add/Remove Windows Component]
Attachment attachment

Click to Check the [Internet Information Services (IIS)] then Click [Details] and make sure that all component are checked off
Attachment attachment

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.
Attachment attachment

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.
Attachment attachment

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.

Attachment attachment

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

Attachment attachment

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.

Attachment attachment

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.net
Click [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:
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.
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
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
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.

Attachment attachment

Click [Environment Variables].

We need to add php folder Path To windows Variables (User Variables and System Variables)

Attachment attachment

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]

Attachment attachment

Under Application Setting section, Click Configuration.

Attachment attachment

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]

Attachment attachment

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…].

Attachment attachment

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::
<?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/downloads
Search 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).

Attachment attachment

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.

Attachment attachment

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.

Attachment attachment

Click [Next].

It's time now to adjust some security options.

Attachment attachment

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].

Attachment attachment

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

Attachment attachment

If you see the above screen, that's means MySQL is working good.
Try to type this:
show databases;


This will show you all available data bases in MySQL data folder (C:\Program Files\MySQL\MySQL Server 5.0\data\)

Attachment attachment

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:

Attachment attachment

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



View PostElemental_1_1, on 22 Jan, 2009 - 10:30 PM, said:

Geat tutorial! I have been looking for something like this for a while! Thanks again, you should get something for posting this!



This is very important to follow the instruction step by step.I followed several tutorials from internet but this tutorials just works for me...
Was This Post Helpful? 0
  • +
  • -

#7 sonofjorel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-August 12

Posted 30 August 2012 - 07:54 AM

I am running W7 Ult 64-Bit and would like to set up a php testing server for a website I am developing. Do I really need to install MySQL if I am using a hosted MySQL database on GoDaddy or can I get by just installing IIS and PHP?
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9052
  • View blog
  • Posts: 33,984
  • Joined: 12-June 08

Posted 30 August 2012 - 08:19 AM

If you want to operate your test machine like your production then yes - having a test database on that machine would be a pretty swell idea.
Was This Post Helpful? 0
  • +
  • -

#9 sonofjorel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-August 12

Posted 30 August 2012 - 08:28 AM

View Postmodi123_1, on 30 August 2012 - 08:19 AM, said:

If you want to operate your test machine like your production then yes - having a test database on that machine would be a pretty swell idea.


I don't really have any "real" data on in MySQL database just yet. It's just test data I collected while capturing information from the contact form I created. If I can use this for testing php code I dont see a reason to install MySQL unless IIS and PHP requires it to function.
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9052
  • View blog
  • Posts: 33,984
  • Joined: 12-June 08

Posted 30 August 2012 - 08:44 AM

Sure the data in your 'production' db might be crap now, but eventually it won't - right? The whole point of having a test environment and a production environment is to keep code, changes, data, etc separate. Having one bleed into the other is just a bad practice and pretty much flies in the face of the environment concept.

Again - yes.. install that test DB.. copy the data from production into the test db and work with the test db on the test machine.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1