When talking about the configuration and installation of the PHP environment, Apache is usually mainly equipped with PHP configuration. As the PHP version is constantly updated, the support for the Windows IIS platform is getting better and better, it is more and more convenient to configure and install the PHP environment on Windows IIS platform.
After building the Apache + PHP + Mysql environment on Windows 7, I configured and installed PHP5.2 and PHP5.3 on the Windows 7 IIS7 platform, PHP configuration methods in versions earlier than PHP5.3 on the Windows IIS platform are mainly implemented through ISAPI, while PHP5.3 supports IIS to run PHP In FastCgi mode, the configuration and installation of the two PHP5 versions are quite different. The following describes how to configure PHP on IIS by using ISAPI and FastCgi.
Preparations
Before completing the installation and configuration of PHP5 on IIS, you first need to download PHP5.2 and PHP5.3, PHP5.3 to the php-5.3.2-Win32-VC9-x86 prevail, please refer to the PHP environment to build: Windows7 Apache + PHP + Mysql article.
Install IIS7 on Windows 7
Before installing and configuring IIS7 PHP, you must first install IIS7. IIS is not installed in Windows 7 by default. The installation process is as follows:
First, enterControl Panel, ClickPrograms and functionsAnd then clickEnable and Disable Windows, SelectWeb core that can be hosted by Internet Information ServicesTo confirm the installation.
After the installation is complete, selectInternet Information Service, Select to install the necessary IIS functions. Note that IIS7 configures PHP In the ISAPI and FastCgi mode When configuring PHP5.2 and PHP5.3, therefore, you must check Cgi and ISAPI extensions and ISAPI filters (because I configure PHP5.2 In the ISAPI mode first, I did not check Cgi ),
Install IIS7
After Windows 7 IIS7 is installed, you can see the Internet Information Service Manager option in the management tools on the control panel.
On Windows 7 IIS7, how does one configure PHP5.2 using ISAPI?
IIS7 PHP5.2 configuration Step 1: php. ini configuration
Decompress php-5.2.13-win32-vc6-x86.zip, rename it to php52iis, copy it to the C root directory, and set php. ini-list file name changed to php. ini, open php. ini configuration, php. ini configuration and PHP environment setup: Windows 7 Apache + PHP + Mysql are basically the same. Note that the extension_dir directory must be accurate, that is
1 |
Extension_dir = "C:/php52iis/ext" |
In addition, the date. timezone option is not available in PHP5.2, so you do not need to set it.
Php. after ini configuration, copy it to the C: \ WINDOWS directory, and then copy libmcrypt under the PHP52iis directory. dll, libmysql. dll, php5ts. dll files to the C:/windows/System32 directory.
Step 2 of IIS7 PHP5.2 configuration: Configure PHP5.2 using ISAPI
Open IIS, select the ISAPI filter in the Default Web Site under the website for PHP configuration, that is
Add an ISAPI filter and select the corresponding php dll file.
Then select the handler ing to add the script ing, that is
Add script ing
After completing the preceding PHP5 configuration for IIS7, You need to note that by default, the website under IIS7 is bound to port 80 and the website directory is % SystemDrive % \ inetpub \ wwwroot, if you have installed and configured the Apache + PHP environment before, you need to modify the default website binding port and website directory. For example, change port 80 to port 8080, and the website directory points to D: \ PHPWeb. Or Add a new website, that is, add an application pool and then a website.
Add application pool
Add new website
Add default document
After adding a new website, make sure there is a script ing added in the handler ing. If not, repeat the script ing operation.
Step 3 of IIS7 PHP5.2 configuration: restart the IIS7 Server
Create an index. php file in the D: \ PHPWeb directory. The content is as follows:
Enter http: // localhost: 8080/in the browser to view the PHP5.2 configuration information.
Now, you have installed and configured PHP5.2 on Windows 7 IIS7.
On Windows 7 IIS7, how does one configure PHP5.3 in FastCgi mode?
PHP5.3 is configured in the FastCgi mode on Windows 7 IIS7, which is basically the same as PHP5.2. First extract the php-5.3.2-Win32-VC9-x86, rename it php53iis, and copy it to the C-drive root directory.
IIS7 PHP5.3 configuration Step 1: Add a website
For details about how to add IIS PHP5.2, refer to the configuration of IIS PHP5.2.
Step 2 of IIS7 PHP5.3 configuration: Add FastCgi module ing
Click "handler ing" to add a module, that is
Configure IIS to run PHP5.3 in FastCgi Mode
Step 3 of IIS7 PHP5.3 configuration: php. ini configuration
First, rename php. ini-development to php. ini and
1 2 3 |
Fastcgi. impersonate = 1 The default value is 0. If you are using IIS, You need to enable Cgi. fix_pathinfo = 1 Cgi. force_redirect = 0 is enabled by default. If you use IIS, you can disable it. |
Specify the extension_dir directory and date. timezone, that is
1 |
Extension_dir = "C:/php53iis/ext" |
1 |
Date. timezone = Asia/Shanghai |
Other PHP. the INI configuration is the same as the PHP5.2 configuration. The difference is that PHP is not required when you configure and install php on Windows 7 IIS7. ini and other files are copied to the C:/windows and C:/windows/System32 directories, which is much simpler.
Step 4 of IIS7 PHP5.3 configuration: restart the IIS7 Server
Access http: // localhost: 8080/at the same time.
How can the FastCGI process be unexpectedly exited?
When you use Windows 7 IIS7 for PHP configuration and installation, if the PHP configuration is incorrect, the FastCGI process will exit unexpectedly. In this case, you can use it in DOS
1 |
C: \ php53iis \ php.exe-v |
For debugging and viewing, the PHP configuration error message is usually reported. You only need to modify the relevant PHP configuration according to this information. Now we have finished the configuration and installation of PHP5.2 and PHP5.3 on the IIS7 platform of Windows 7. It should be said that with the improvement of the PHP version, the configuration of PHP is becoming simpler and simpler.
PHP website development tutorial-leapsoul.cn All Rights Reserved