Install PHP on IIS

Source: Internet
Author: User
The PHP-based forum can be said to be the most secure and most efficient forum for code execution. It can be better integrated with MYSQL than ASP, with PHPMYADMIN, you can better manage and maintain database information. Generally, it is quite easy to use apache and PHP in combination. However, due to the limitations of specific factors and conditions, we need to establish a PHP application environment on the basis of IIS. Today, I will introduce how to create a PHP application environment under IIS and Windows.

I. environment requirements and preparations:

To make it easier for IT168 readers to use PHP, I chose PHP5.2, while IIS is IIS 5 that comes with XP. First, we need to install the IIS component. By default, it is not installed on the XP system.

Step 1: Install IIS components by adding/deleting Windows components on the control panel.

Step 2: In the Windows component options window, double-click Internet Information Service (IIS) and select internet Information Service management units, public files, and World Wide Web Services. (1)

Figure 1

Step 3: insert the XP SP2 system CD to copy the required files to the local hard disk. After installation, we can start the IIS program from "internet Information Service" in "Administrative Tools. (2)

Figure 2

Ii. Install the PHP program and settings:

After IIS is installed, we can publish the corresponding website, but we still cannot browse the page created in PHP language. We need to install PHP and set necessary parameters first.

Step 1: Download the PHP main program. The author uses PHP 5.2 and decompress it to the c root directory of the local disk. (3)

Figure 3

Step 2: Next, set PHP in the php folder. copy ini-dist to the C:/WINDOWS directory and change it to php. ini, copy php5ts. dll and libmysql. dll files to C:/WINDOWS/system32. (4)

Figure 4

Step 3: to allow PHP to support MYSQL and GD libraries, You need to edit php. INI file, open the file in notepad, find "extension_dir", and then set extension_dir = ". /"change to extension_dir =" C:/php/ext "; remove the semicolon before"; extension = php_mysql.dll "and change it to extension = php_mysql.dll. Remove the semicolon before "; extension = php_gd2.dll" and change it to extension = php_gd2.dll.

So far, our PHP installation is complete, but by default, IIS does not support PHP and can only support ASP. Therefore, we also need to create a PHP ing like creating CGI.

3. Configure the PHP ing of IIS:

In general, setting the ing between a language or execution program is solved through the ISAPI filter, and PHP is no exception.

Step 1: Open IIS and right-click on the default website and select "properties ". (5)


Figure 5

Step 2: Find the "main directory" label and click "Configure" in the lower right corner. (6)

Figure 6

Step 3: In the "add and edit application extension ing" window, click the Browse button to find c:/php/php5isapi. dll file, extension input. php. In this way, the php5isapi will be automatically called during the parsing process. dll explains the PHP language. You also need to select "Script Engine" and "check whether the file exists. (7)

Figure 7

Step 4: return to the "home directory" tab in the default website Properties window and change the execution permission to "script and executable file" to run the PHP program. (8)

Figure 8

Step 5: Go to the "document" tab in the default website Properties window and add index. php to the default document list. (9)

Figure 9

Step 6: Create a TXT file with the following content. Save it as the index. php file and copy it to the website publishing directory. (10)
<?
Echo phpinfo ();
?>

Figure 10

Step 7: view the index. php page file in IIS to see the real content. This shows that our PHP environment has been successfully set up. (11)

Figure 11

TIPS: If index. if php cannot be properly displayed, we will go to the ISAPI filter tag in the default website attribute and add a filter named PHP. Select c:/php/php5isapi as the executable file. dll. (12)

Figure 12

Step 8: After modifying the settings, restart IIS or simply start the computer. After restarting, the PHP file will be displayed smoothly. To restart IIS, you can disable the "iis admin" service or right-click the default website and choose "Stop" and then "start ".

Iv. Summary:

In general, PHP is still relatively stable in IIS, although it is less efficient than apache and PHP in terms of execution efficiency, however, on the Enterprise Server, you must use IIS or multiple websites to publish through a virtual directory. We have to choose the method described in this article to build the PHP environment. In addition, the latest version of Apache and PHP5 also have certain compatibility problems. Using IIS and PHP5 can reduce unnecessary compatibility problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.