How to install PHP and MySQL on IIS

We will learn how to install PHP for IIS. First we need to download PHP and install IIS.

To install IIS, you need the Windows XP installation CD. Go to Control Panel-> Add/Remove Programs and click on Add/Remove Windows Components. Check Internet Information Services (IIS) and insert the CD with Windows Xp. After that, press Next and wait until IIS is installed.

Step :1. Extract the file from php archive to c:/php/. Copy php5ts.dll to the web server's directory (C:/inetpub/wwwroot) and Windows system directory (C:/windows/system32).

Step :2. Set up the config file for PHP, php.ini. Rename php.ini-dist to php.ini and copy the file to windows folder: C:/Windows. PHP stores in php.ini all the configurations and if you want to install, for example, an extension, you will need to modify this file. Edit php.ini in wordpad and replace doc_root= with doc_root = "C:/inetpub/wwwroot/" and also check if cgi.force_redirect = 0

Step :3. dd c:/php to environment variables PATH. For that, right-click on My Computer and choose Properties. Go to Advanced Tab and click the Environment Variables button. In system variables find the variable PATH. There, go to the end of the line and add an ";" and type C:/php. Click OK here and for the Environment Variables. We need to reboot the computer to activate the changes.

Step :4. Configure IIS to work with PHP. Go to Control Panel -> Administrative Tools -> Internet Services Manager and start IIS. Right click on Default Server and choose Properties. Go to Home directory, set "Execute Permissions" to "Scripts Only" and click Configuration. Click Add, choose Executable C:/PHP/php5isapi.dll and set Extension to .php. After that, go to Isapi Filters, click Add and set Filter Name to PHP and Executable to C:/PHP/php5isapi.dll. Click Apply and then OK. Restart IIS and we're done.

Testing :Create a new document in wordpad, paste this text and save it as phpinfo.php. Copy the file to C:/inetpub/wwwroot. Open your browser and type http://localhost/phpinfo.php

No comments: