The installation of PHP on Windows server running IIS web sever is much simpler than on Unix OS, as such it involves precompiled binary rather a source build.
If you plan to set up PHP running on Windows platform with IIS, then these are prerequisites:
- A working PHP-supported Web server like IIS. In previous editions of PHP, IIS/PWS was the easiest choice since a module version of PHP was available for it; however PHP has added a much wider selection of modules for Windows later.
- A properly installed PHP-supported database such as MySQL or Oracle etc.
- The PHP Windows binary distribution (download it at www.php.net/downloads.php)
- A utility to unzip files link Winzip or Winrar
Follow these steps to set up Apache and PHP5 under IIS, in windows machine. If you want to install different version of PHP then please follow accordingly.
- Unzip the binary archive using your unzip utility; C:\PHP is a common location.
- Copy a few .dll files from your PHP directory to your systems directory (usually C:\Winnt\System32). You need php5ts.dll for every case. You may also need to copy the file corresponding to your Web server module – C:\PHP\Sapi\php5isapi.dll. It is possible that you will need others from the dlls subfolder – but lets start with the two mentioned above and add more as per requirement later..
- Copy either php.ini-dist or php.ini-recommended (preferably later) to Windows directory (C:\Winnt or C:\Winnt40), and rename it php.ini. Open this file in a text editor . Edit this file to get configuration directives; We highly recommend new users set error reporting to E_ALL on their development. For now, the most important thing is the doc_root directive under the Paths and Directories section. Make sure this matches your IIS Inetpub folder (or wherever you plan to serve out of).
- Restart WWW service.
- Go to the Start menu -> Settings -> Control Panel -> Services.
- In opened window scroll down the list to IIS Admin Service. Select it and click Stop. After it stops, select World Wide Web Publishing Service and click Start. Stopping and restarting the service from within Internet Service Manager will not suffice. Since this is Windows, you may also wish to reboot.
Now lets test if PHP is working or not.
For that open a text editor and type
<?php phpinfo(); ?>
Save this file in your Web server’s document root directory as “info.php”.
Open Web browser and type the file. You must always use an HTTP request (http://www.yourdomain.com/info.php or http://localhost/info.php or http://ip-address/info.php) rather than a filename (/home/httpd/info.php) for the file to be parsed correctly.
You should see a table of information about your new PHP installation message. If this is then Congratulations!