This Windows hosting tutorial will explain how to install PHP using ASP.NET hosting.
Many times along with ASP.NET and MS SQL you will need PHP and MySQL for your web applications. Most of the best ASP.NET hosting companies offer preinstalled PHP and MySQL with their plans. Anyway, there could be possible to install manually the PHP on your hosting server.
You can easily install PHP using Microsoft® Web Platform Installer. It completely automates setting up IIS, FastCGI, and the latest version of PHP from the php.net Web site. There are two builds for each PHP version: one is thread-safe, and one is not. The other option is to use the Windows Zip file from the PHP Web site (http://www.php.net/downloads.php).
Install PHP using Windows Installer
With Windows Installer you can easily install PHP, but by default, no extensions are installed. You can manually install all of the extensions, but this results in an unstable system because some of the extensions can conflict with others. It is generally easier to use the Zip file installation.
Install PHP via Zip File
The Zip file installation installs many of the extensions that are available for the Windows Installer version. To install the PHP follow the next steps:
1. Download the latest non-thread-safe Zip file package.
2. Unpack the files to a directory of your choice (by example, C:\PHP) on your IIS server.
3. Open the Php.ini file in a text editor, then uncomment and modify settings as follows:
– fastcgi.impersonate = 1.
– cgi.force_redirect = 0.
– Set open_basedir to point to a folder or network path where the content of the Web site(s) is located.
– Set extension_dir to point to a location where PHP extensions reside.
5. Click on Start, Settings, Control Panel, and then double-click on the System icon
6. Click on the Advanced system settings link in the left column.
7. From the System Properties window, click on the Advanced tab, and then click on the Environment Variables button at the bottom.
8. Select the Path variable from the System Variables section, and then click on Edit. Add: c:\php to your system path.
9. Click OK until you have exited the System Properties window.
10. Start IIS Manager by clicking on Start, Programs, Administrative Tools, and then Internet Information Services (IIS) Manager.
11. From the IIS Manager, click on the hostname of your server in the Connections panel on the left.
12. Double-click on the Handler Mappings icon.
13. From the Handler Mappings Actions panel, click on Add Module Mapping.
14. Type the following information into the appropriate text boxes, and then click OK.
– Request path: *.php
– Module: FastCGImodule
– Executable: C:\php\php-cgi.exe
– Name: FastCGI
15. Click OK, and then click Yes.
16. In the left panel, click on your server’s hostname, and then double-click on the Default Document icon.
17. From the Actions panel on the right, click Add.
18. Enter index.php as the new default document name, and then click OK.
19. Enter default.php as the new default document name, and then click OK.
20. In the left panel, click on your server’s hostname.
21. In the Actions panel on the right, click Restart.
22. Create a new text document, and save it as c:\inetpub\wwwroot\phpinfo.php with the following content:
<?php phpinfo(); ?>
23. You should now see the PHP information page at http://localhost/phpinfo.php.