Advertisment

Setting PHP on IIS

author-image
PCQ Bureau
New Update

PHP (PHP Hypertext Preprocessor) is a server side scripting language, which borrows its syntax from C, Perl and Java. To install PHP on IIS 5 (Internet Information Server), on a Windows 2000 Server, unzip the file php-4.1.1-Win32.zip from the ‘cdrom\dev\scripting engines\ php’ directory on this month’s CD to c:\php. Copy the file php.ini-dist to c:\winnt directory. Rename it to php.ini and open this file in a Notepad. In the section “Paths and Directories” change the line ‘doc_root = ‘ 



to:

Advertisment

doc_root = “c:\inpetpub\wwwroot” 



and change the line ‘extension_dir=./’ to:


extension_dir = “c:\php”

Copy the file php4ts.dll found in c:\php to winnt\system32 directory. Now launch ‘Internet Service Manager’ applet in Control Panel>Administrative Tools. Right-click on the computer name (labeled with a computer icon) and select properties. In the “Internet Information Services” tab, click the ‘Edit’ button in the ‘Master Properties’ section. Click on the ‘Home Directory’ tab and then on the ‘Configuration’ button. Under the ‘App Mapping’ tab click on ‘Add’. For ‘Executable’ type c:\php\SAPI\php4isapi.dll. For ‘Extension’ type .php (note the dot prefix). Now come to the main Window - after clicking on OKs to accept the settings, right click on the computer name and select ‘Restart IIS’. 



Write a PHP script in Notepad as:

Advertisment

and save it with the name test.php in the directory c:\inpetpub\wwwroot. Remember we specified this directory as the doc_root in the php.ini file. Now type the following URL in the Internet Explorer on the same machine running

IIS.

http://127.0.0.1/test.php

If everything worked, you’ll see ‘PHP works on IIS’. To test you PHP scripts you can place them in the wwwroot directory and access them likewise.

Advertisment