faqts : Computers : Programming : Languages : PHP : Installation and Setup : Web Servers : Microsoft Internet Information Server (IIS)

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

55 of 74 people (74%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

PHP: Install: How to install PHP on Microsoft Internet Information Server (IIS)?

Jul 14th, 2006 06:28
Knud van Eeden, Philip Olson, Sunny Rao,


----------------------------------------------------------------------
Philip Olson
The PHP Manual is clear on this. Before installing PHP on a Windows
system, be sure to read the Manual Installation Instructions:
 http://php.net/manual/en/install.windows.manual.php
Next, read the instructions specific to IIS here:
 http://php.net/manual/en/install.windows.iis.php
===
----------------------------------------------------------------------
--- Knud van Eeden --- 12 January 2021 - 08:09 am --------------------
PHP: Install: How to install PHP on Microsoft Internet Information 
Server (IIS)?
---
Steps: Overview:
 1. -Download and install PHP program
 2. -Add the path to <your PHP directory> to the Microsoft Windows PATH
     environment variable
 3. -Copy the file
      php.ini-recommended
     to
      php.ini
     in <your PHP directory>
 4. -Edit this file php.ini
     1. -Set doc_root to c:\Inetpub\wwwdir
     2. -Possibly set the extension_dir to <your PHP directory>\ext
 5. -Change the settings of IIS
     1. -Add the '.PHP' extension in 'Home Directory' in IIS
         1. -You do usually not also have to install a PHP ISAPI filter
             (only if you also want HTTP authentification)
     2. -Only if you use Microsoft Windows 2003 Server, add a new PHP
         'Web Service extension' in IIS (otherwise you get a HTTP 404
         error)
 6. -Restart IIS
 7. -Test if PHP is installed correctly
     1. -Copy a .PHP page in the c:\Inetpub\wwwroot directory
     2. -Start your web browser with that .PHP page
          http://localhost/<your PHP filename>
===
Steps: Worked out:
 1. -Download a PHP for Windows program (extension .zip)
      http://www.php.net/downloads.php
    1. -Install it e.g. in
        (this will further be called <your PHP directory>)
         c:\program files\PHP
        or
         c:\PHP
 2. -Add the path to <your PHP directory> to the Microsoft Windows PATH
     environment variable
     This way the PHP DLL files, PHP executables, and php.ini can all
     remain in the PHP directory without cluttering up the Windows
     system directory.
     (Usually you set the path globally via 'Start'->'Control
      panel'->'System'->'Advanced'->'Environment
      variables'->'Path'->'Edit', then add ;<your PHP directory>)
     1. -Only if you choose to *not* set this path,
         you could e.g.
         1. -copy the file
              php4isapi.dll (if you install PHP 4)
             or
              php5isapi.dll (if you install PHP 4)
            to your Windows directory
             c:\windows (if you use Microsoft Windows XP Professional)
            or
             c:\winnt (if you use Microsoft Windows 2003 server)
            Note:
            You should find this file
             php4isapi.dll (if you install PHP 4)
            or
             php5isapi.dll (if you install PHP 5)
            in the php directory after the installation or unzipping of
            php, otherwise in the apache directory (if that web server
            is also installed on your machine)
            ---
         2. -Copy the file
             php4ts.dll (if installing PHP 4)
            or
             php5ts.dll (if installing PHP 5)
            to your Windows system32 directory
             c:\windows\system32 (if you use Microsoft Windows XP
             Professional)
            or
             c:\winnt\system32 (if you use Microsoft Windows 2003
             Server)
         3. -Check if the file
              msvcrt.dll
             is present in your windows system directory
              c:\windows\system32 (if you use Microsoft Windows XP
                                   Professional)
            or
             c:\winnt\system32 (if you use Microsoft Windows 2003
                                Server)
            If not, copy this file (if present) from e.g. your php
            directory to this windows system directory
         4. -Possibly copy or save this php.ini file in the directory
              c:\windows\php.ini (if using Microsoft Windows XP
              Professional)
             or
              c:\winnt\php.ini (if using Microsoft Windows 2003 Server)
             otherwise in the apache directory (if that web server is
             also installed on your machine)
             ---
             Note:
             It might be a much better solution to not copy this
             php.ini to your c:\windows or c:\winnt directory, but to
             keep it in the PHP directory where your php.exe file is
             located.
             This because if you have say PHP 3, PHP 4 and PHP 5
             installed on your computer, they then all have their own
             php.ini in that case.
             And should you keep your php.ini centrally in your
             c:\windows directory, then all these different versions
             will usually try to use that one php.ini (which is usually
             only optimized and usable for only one version of PHP
             (e.g. PHP5) at once).
             Thus possibly delete the central
              php.ini
             in your c:\windows directory and keep a local php.ini in
             each of your PHP version directories (that is there where
             you find that php.exe or php-cgi.exe program).
 3. -Copy the file
      php.ini-recommended
     otherwise
      php.ini-dist
     (which after installation is present in <your PHP directory>
     to
      php.ini
     in <your PHP directory>
 4. -Edit this file
      php.ini
     1. Open your favorite editor (e.g. notepad.exe)
     2. Load that file php.ini
     3. Edit the entries (search for this words in the file, e.g. using
        <CTRL><F>)
        1. Change the 'doc_root' to point to your Microsoft Internet
           Information Server (IIS) root directory
            doc_root = c:\inetpub\wwwroot
        2. I also had to comment out the line
            ; browscap
           otherwise I got a warning when IIS started
        3. You could further choose to possibly change the
           'extension_dir' to point to the place containing the DLL
           modules for the extensions ('ext' is usually a directory
           present in the same directory where you installed PHP) But
           you might choose skip this.
           e.g. the default is (which means in the current
                default PHP directory)
            extension_dir = "./"
           Otherwise change it to
           e.g.
            extension_dir = <your PHP directory>\ext
           e.g.
            extension_dir = c:\program files\php\ext
           e.g.
            extension_dir = c:\php\ext
           e.g.
            extension_dir = c:\apache\php\sapi (if you are also using
            Apache)
 5. -Change the settings of IIS
     1. -Make sure Microsoft Internet Information Server (IIS) is
         installed
          http://localhost
         should then show a working web page
     2. -Now inform IIS that you want it to check also for PHP pages
            2. Inform that IIS also has to react when your webpage has
               the .php extension
                 1. -select tab 'Home Directory'
                 2. -click button 'Configuration'
                 3. -click button 'Add'
                 4. -In 'Executable', browse to the dll that will
                     handle this .php extensions:
                     e.g. browse to this file
                           php4isapi.dll (if installing PHP 4)
                           or
                           php5isapi.dll (if installing PHP 5)
                     that was included with the PHP program that you
                     installed,
                     e.g.
                      c:\apache\php\sapi\php4isapi.dll
                     otherwise try
                      c:\windows\php4isapi.dll
                 5. -fill in in 'Extension'
                      .php
                 6. -click button 'OK' until finished
     3. -If you are installing on Microsoft Windows 2003 Server, you
         will have to do the following (otherwise you will get an error
         404 when you try to open a .PHP page)
         1. -Open up the IIS Manager
         2. -Go to Web Service Extensions
         3. -Choose "Add a new Web service extension"
         4. -Enter in a name such as
              PHP
         5. -Click button 'Add'
         6. -For the value browse to either the ISAPI file
         (php4isapi.dll or php5isapi.dll)
         7. -Enable checkbox 'Set extension status to Allowed'
         8. -Click button 'OK'
     4. -Possibly install HTTP authentification (but you can just skip
         this installation steps usually, as you just told IIS already
         what to do when it finds a file with a .php extension)
        1. Inform where IIS can find the dll that will check and handle
           the PHP information:
           1. -Goto the Microsoft Internet Information Server (IIS)
               management console
               1. -click button Windows 'Start'
               2. -select from list 'Control Panel'
               3. -double click on icon 'Administrative tools'
               4. -double click on icon 'Internet Information Services'
               5. -that will open the dialog box 'Internet Information
                   Services'
               6. -click the '+' at the name of your computer
               7. -This will open its Internet sites in the left pane
               8. -Right click on 'Web Sites'
               9. -select from list 'Properties'
              10. -select tab 'ISAPI Filters'
              11. -click button 'Add'
              12. -fill in some name (e.g. 'PHP') in 'Filter Name:'
              13. -click the browse name and browse to the location of
              the
                    php4isapi.dll (if installing PHP 4)
                   or
                    php5isapi.dll (if installing PHP 5)
                    e.g.
                     c:\program files\php\php4isapi.dll (if installing
                     PHP 4)
                     or
                     c:\program files\php\php5isapi.dll (if installing
                     PHP 5)
                    e.g.
                     c:\apache\php\sapi\php4isapi.dll (if installing
                     PHP 4)
                     or
                     c:\apache\php\sapi\php4isapi.dll (if installing
                     PHP 5)
                    otherwise try e.g.
                     c:\windows\php4isapi.dll (if installing PHP 4)
                     c:\winnt\php4isapi.dll (if installing PHP 4)
                     c:\windows\php4isapi.dll (if installing PHP 5)
                     c:\winnt\php4isapi.dll (if installing PHP 5)
              14. -click button 'OK'
              15. -click button 'OK'
 6. -Now restart your IIS
     1. -Right click on the computer name, choose 'All tasks' (if using
         Microsoft Windows 2003 server), choose 'Restart IIS
         information server')
     2. -Or if you want to do this from a MSDOS command prompt or run
     box, type:
          net stop iisadmin
          - and/or -
          iisreset /stop
      3. Then start IIS again by using
          net start w3svc
          -- and/or --
          net start iisadmin
          - and/or -
          iisreset /start
 7. -Now test if your .php files are recognized via IIS
      1. To check if IIS is working in your browser:
         type in the URL field of your browser the following text:
          localhost
          this is the default, and is accepted without a login
          ---
         or otherwise
          127.0.0.1
         Then possibly supply:
          (userid=<your Windows2000/XP userid>
           password=<your Windows2000/XP password>)
      ---
      Then 2 browser windows with information open.
      --- ---
      To run .php programs, you must store them inside the homepage
      directory
       \inetpub\wwwroot
      --- ---
      For example, if you create a file
       myfilename.php
      and you store this in the default directory:
       \inetpub\wwwroot\
      (e.g. as \inetpub\wwwroot\myfilename.php) you can access this
      .php file in your browser by typing the URL:
       http://localhost/myfilename.php
      (note: do not add 'www' here, like
        http://www.localhost/myfilename.php that will not be
        recognized)
      --- ---
      Your .php test page might contain e.g. only this text:
       <?php phpinfo(); ?>
      If IIS recognizes this correctly it will show a webpage with a
      lot of information about PHP variables in use.
      --- ---
      Note:
      To run your pages in your browser, your URL *must* start with
       http//localhost/...
      or
       localhost/...
      or
       http://<your computername>
        e.g.
       http://delli8500
      or
       http://<your computer IP address>
        e.g.
       http://12.13.14.15
      ---
      else using e.g. the real filename, like
       c:\inetpub\...
      or
       c:\inetpub\wwwroot\...
      will *not* run the .php page (or similarly .asp, .aspx code) (but
      instead possibly show a blank HTML page or a page with some text)
    ===
    If you get an error 404 check if you have set the values in 'Web
    Service Extensions', if you installed on Microsoft Windows 2003
    Server
    ===
    Double check if
      -if 'extension_dir' is set in php.ini,
      -if 'docroot' is set in php.ini,
      -if the PATH environment variable points to your PHP dll
       directory,
      -Only if you also (optionally) installed the ISAPI PHP dll,
       the arrow should be green (and not red) and pointing up in IIS
      -if the php extension has been set in IIS
---
---
Successfully installed on Microsoft Windows XP Professional
using
Microsoft Internet Information Server (IIS) v5.1
and
PHP 4
---
Successfully installed on Microsoft Windows 2003 Server
using
Microsoft Internet Information Server (IIS) v6
and
PHP 5.1.4
---
---
Book: see also:
---
[book: author: Welling, Luke / Thomson, Laura - title: PHP and MySQL 
web development - publisher: SAMS - year: 2001 - ISBN 0-672-31784-2 - 
p. 800 'Installation notes for Microsoft IIS']
---
---
Internet: see also:
---
PHP: Microsoft Windows: manual installation instructions
http://us2.php.net/manual/en/install.windows.iis.php
---
PHP: Microsoft Windows: manual general installation instructions
http://php.net/manual/en/install.windows.manual.php
---
PHP: Microsoft Internet Information Server (IIS)
http://php.net/manual/en/install.windows.iis.php
---
How do I install PHP3.06 with IIS4 on NT4.0?
http://www.faqts.com/knowledge_base/view.phtml/aid/165/fid/37
---
Installing PHP 3.x.x for IIS 4.x on Windows NT
http://www.e-gineer.com/instructions/install-php3xx-for-iis4x-on-
windowsnt.phtml
---
Internet: Web server: How install Microsoft Information Server (IIS) 
on Windows2000/XP Professional?
http://www.faqts.com/knowledge_base/view.phtml/aid/12558
---
Internet: Web Server: Microsoft Information Server: IIS: How 
start/stop IIS from MSDOS command line?
http://www.faqts.com/knowledge_base/view.phtml/aid/27413/fid/935
---
WebThang Tutorials: How to install PHP for IIS on XP Pro
http://216.239.59.104/search?
q=cache:b3avUSjLdSEJ:www.webthang.co.uk/tuts/tuts_server/php_iis/php_ii
s.asp+WebThang+Tutorials+PHP+IIS&hl=en
---
Operating system: Microsoft Windows: WAMP: Link: Overview: Can you 
give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/33803/fid/772
----------------------------------------------------------------------