Вы находитесь на странице: 1из 8

I N STA LL PHP 5.

2 ON W IN D O W S 7 AND IIS 7

Part-1

Installing PHP 5.2.10-Win32 on Windows7 32 bit is practically the same as Vista, but I had few people asking me how to
do it, so I wrote a new Tutorial, and I tested all the steps on a 32bit version, so far. Follow these steps and I can
guarantee, you'll get it running. .You can visit the PHP website and download the php version php-5.2.10-Win32.zip for
the manual installation not the windows installer version, As IIS 7 is not installed by default on Windows7,you will have to
install it first, but it's a very easy task and you can have a look at this step by step tutorial to learn how to do it. How to
install IIS 7 on Windows7. Ok, all clear, we can start with the actual steps:

1. Log on as Administrator First step ,I have Windows7 installed on D:\ drive, so from now on I'll mention the
system drive as D:\, obviously you will change it with whatever your drive is. Unzip the php-5.2.10 file in this
directory D:\PHP5.

2. Then open the newly created PHP5 folder and open the file php.ini-recommended with Notepad and
click File .>Save as ,then in the dialog box type only php.ini and in Save as type choose all files not .txt files as
default, remember!!. Save it in the same directory, this will be the configuration file for the PHP engine.

Fig1

3. There isn't much to change in the basic configuration to get it started all you have to do is tell PHP to load
particular modules when it starts ,open php.ini with notepad or any text editor ,find extension_dir and change it
as extension_dir = "D:\PHP5\ext" see Fig1 and then find Dynamic Extension, in this section there are all the
modules to be loaded Find out which one you need from the PHP website and to enable it just remove the ";" in
front of it.For example for MySql remove the ";" before "extension=php_mysql.dll "and
"extension=php_mysqli.dll". To enable the PHP graphic library remove the ";" before
"extension=php_gd2.dll" … See Fig2
Save and close the php.ini file.
–2– November 23, 2009

Fig2

4. I know that someone ,at this stage, recommends to copy php.ini and few dll to the Windows/System32 folder,
but I believe it's a lot better keep all the files in the same directory, consider if you have to change some setting
in the future, and you've forgotten where php.ini is or any other php file. To keep all the files in the same
directory you have to tell Windows where PHP is. Click Start, Right-click Computer and choose Properties a
window like below opens, click on Advanced System Settings on the left.

5. Then, in the window like the one below, Advanced tab and click on Environment Variables at the bottom
–3– November 23, 2009

Fig3

6. In the Environment Variables window, under System variables, scroll down and look for the variable Path ,click
on it to select it and press edit.
–4– November 23, 2009

Fig4

Fig 5

7. In the new window (fig 5) on Variable value go to the end, and type a semicolon and the path to the PHP folder.
For example," ;D:\PHP5 " .Then another semicolon and the path to the extensions. Example " ;D:\PHP5\ext "
When you finish press OK.

8. You back on Environment Variables (fig 4).This time click on New because you'll have to create a new variable.
A window like fig 5 opens, this time will be empty, type in the Variable name " PHPRC " and in the Variable
value type the directory where PHP is installed " D:\PHP5 " and click OK .This is to tell the System where
php.ini is located, so you can leave all the php files in the same folder. This part is very important, when you
finish installing and you run phpinfo in your browser, check in the first part you should be able to read
something like this :
–5– November 23, 2009

Loaded Configuration File D:\PHP5\php.ini

9. where D:\PHP5\php.ini is the path we are talking about. Now press OK and close the Environment Variables
dialog box

10. Now you should reboot your computer to allow Vista to load the new setting, but I recommend finishing the
second part, first, and then restarting Vista.

Part-2

1. Log on as Administrator Go to Start / ControlPanel / Administrative Tools and double_click on Internet


Information Service

2. IIS Manager window opens(see Fig 4)On the left pane click on whatever your computer name is ,and in the
middle double-click on Isapi Filters.

Fig 4

3. On the right pane, under Action click on add.


–6– November 23, 2009

Fig 5

4. In the Executable type C\:PHP\php5isapi.dll , where c:\PHP is the directory where you have installed PHP and
in the Filter name type PHP and press OK .

Fig 6

5. With the blue arrow on the top-left corner go back to the same page as for Fig 4 ,and this time double-click on
Handler Mapping, on the new window(Fig 7) click on Add Script Map on the right pane under Action.
–7– November 23, 2009

Fig 7

6. On the next dialog Box ( Fig 8)in the Request Path Type *.php (don't forget the star at the beginning) and in
the Executable type C:\PHP\php5isapi.dll , where c:\Php is the directory where you have installed PHP and in
the Name type PHP, and then click OK.

Fig 8

7. When you finish you should get a prompt like the one below (Fig 9).Click OK and close all
the windows and restart your computer to reload the new configurations including the new system variables we
have done in the first part.
–8– November 23, 2009

8. When Vista has restarted log on as Administrator , navigate to the website root, by default C:\InetPub and
right-click on the folder wwwroot choose properties and security tab and grant all permissions to IISUser and to
anyone who has to save files to that folder and close all windows.

Fig 9

Now you ready for the test, open a new file with notepad and type:<?php phpinfo(); ?> Save it in your website root
directory that should be C:\Inetpub\wwwroot as phpTest.php not as text file but all files or it wont work, if you find
problems saving in the website root folder, check the security permissions Open your web browser and type in the
address bar http:/localhost/phptest.php and ,if a page with all the php info appears ,it means that you have php
succesfully installed and running.

Read this article How to set IIS7 to handle PHP in static pages

If you have any problems installing PHP, please, don't hesitate to contact me from here

Вам также может понравиться