After learning about the two most common servers, let's take a look at how to install PHP in IIS. When running PHP, we need a WEB server to support its operation. Next, let's start our journey of installing PHP in IIS!
Install PHP in IIS:
1. decompress the downloaded PHP installation package in IIS to the root directory of your C drive (the C root directory disk is selected here for future convenience of modification and debugging, you can also choose a different directory), decompress it, you should be able to get a directory similar to "php-4.2.3-Win32", change the directory name to "PHP ".
2. open the decompressed PHP Directory and you will find a directory named "php. ini-dist file. This is the PHP configuration file. You need to rename it to "php. ini ", and then copy it to the system directory (If your system is attached to drive C, it is" C: \ windows "under XP, and" C: \ winnt "under Windows2000 ").
In the past, many articles about php files installed in IIS mentioned that php should be modified. in ini, the values of "extension_dir" and "doc_root" have not been changed and no errors have been made during iis php installation. It seems that these two parameters are not required. Of course, you can modify it if you are not at ease.
Change doc_root to the root directory of your server, and change extension_dir to the absolute path of the extensions folder in your PHP installation folder.
3. When installing PHP in IIS, open your IIS information service console, right-click the "default website" icon, select Properties, open the default website attribute selection, and then select the "main directory" tab
Click the "Configure" button, and you will see a new tab, which is a defined document type. Click "add" to add "% s" to the absolute path of your php.exe In the executable file box of the dialog box, where "c: \ php \ php.exe % s ", in the extension text box, write the suffix you want the php program to process. Here we write ". php ", the following options can be set by default.
4. All right. Now, try to save the following code into a PHP file with the suffix, and put it in your virtual directory for access to see if the result is normal. Install PHP in IIS. Check whether it can be used normally?