Home  >  Article  >  Backend Development  >  How to install iis php5.2

How to install iis php5.2

藏色散人
藏色散人Original
2021-03-26 10:22:341585browse

Installation method of iis php5.2: First download the installation package of PHP5.2 for windows and extract it to "C:\PHP"; then modify PHP.ini; then add ";:" after Path. \PHP" value; finally add the application mapping.

How to install iis php5.2

The operating environment of this article: windows7 system, PHP5.2 version, DELL G3 computer

Windows IIS PHP 5.2 installation and configuration method

Step 1: Download the installation package of PHP 5.2 for windows and extract it to C:\PHP. Note that this decompression directory can be on any disk, but the directory name cannot contain spaces;

The following is the file directory of PHP5.2:

c:\PHP --dev | |-PHP5ts.lib --ext -- extension DLLs for PHP | |-PHP_bz2.dll | |-PHP_cpdf.dll | |-.. --extras | --mibs -- support files for SNMP | --openssl -- support files for Openssl | --pdf-related -- support files for PDF | |-mime.magic --pear -- initial copy of PEAR |
|-go-pear.bat -- PEAR setup script |-fdftk.dll |-.. |-php-cgi.exe -- CGI executable |-PHP-win.exe -- executes scripts without an opened command prompt |-PHP.exe -- CLI executable - ONLY for command line scripting |-.. |-PHP.ini-dist -- default PHP.ini settings |-PHP.ini-recommended -- recommended PHP.ini settings |-PHP5activescript.dll |-PHP5apache.dll |-PHP5apache2.dll |-.. |-PHP5ts.dll -- core PHP DLL |-...

Step 2: Change the c:\PHP directory Copy the PHP.ini-recommended (or PHP.ini-dist file, the former is officially recommended) to the current directory, and modify the file name to PHP.ini;

Step 3: Edit PHP.ini. Mainly modify the values ​​of the following two lines:

extension_dir = "c:\PHP\ext"

doc_root = "c:\inetpub\wwwroot" When modifying, you need to delete the beginning of these two lines. of; annotation. The value of extension_dir is the ext directory under the PHP installation directory, and the value of doc_root is the home directory set by IIS;

Step 4: Set environment variables.

Add the following value after Path: ;:\PHP

Then restart the computer.

Step 5: Open the Internet Information Service, find the "Default Website" and stop the website.

Then open the "Properties" page. Find the "Home Directory" label in the "Properties" page, click the "Configure" button, and add application mapping.

The values ​​are:

Executable file: c:\PHP\PHP5isapi.dll

Extension: .PHP

No need to modify the rest. After confirmation, restart the default website;

Step 6: Create a new file hello.PHP under c:\inetpub\wwwroot. Input content:

<?php echo "Hello world" ?>

After saving, open the browser and enter the address: http://localhost/hello.PHP. If Hello world is displayed on the web page, it means the installation is correct. We can also view the source code of hello.PHP on the web page. If there is no PHP code in the source code, it also means that the installation is correct.

[Recommended learning: PHP video tutorial]

I summarized something by myself after referring to a large number of other people’s installation documents. I hope it will be useful to everyone. . . .

1. Two different modes of PHP installation - CGI mode and modular installation mode

In CGI mode, if the client requests a PHP file, the web server calls PHP.exe To interpret this file, and then return the result of the interpretation to the client in the form of a web page; in modularization, PHP starts and runs together with the web server, so from a certain perspective, installing PHP as an apache module Better security and better execution efficiency and speed than CGI mode

The following examples take PHP4.4.0 as an example and are implemented in the Windows XP environment.

1. Installation under IIS (ISAPI mode installation)

(1) Extract the PHP compressed package to c:\PHP\

(2) Copy PHP. Rename ini-dist to PHP.ini and copy it to c:\windows (copy to c:\winnt for window 2000)

(3) Copy c:\PHP\PHP4ts.dll to c:\windows Under \system32 (not necessarily required)

(4) Configuration of IIS5.0. Open "Control Panel" => "Administrative Tools" => "Internet Services Manager".

Right-click "Default Web Site" and select "Properties".

Click the "ISAPI Filter" tab, click "Add", select PHP4isapi.dll in c:\PHP\sapi, and name it PHP.

Click the configuration button in the home directory and click "Add" in the "Application Configuration" dialog box. The "Add/Edit Application Extension Mapping" dialog box will appear. Click "Browse" and select PHP4isapi.dll in c:\PHP\sapi. Extension .PHP, other defaults are sufficient.

2. Installation under IIS (CGI mode installation)

(1) Download PHP's windows installation program PHP-4.4.0-installer.exe, which does not include any external PHP extension (PHP_*.dll).

(2) Follow the step-by-step installation wizard. The installation wizard will collect enough information to set up the PHP.ini file and automatically configure the IIS server. (It is also possible when using apache as the server, but it cannot be configured automatically and needs to be done manually)

(3) After the installation is completed, PHP in CGI mode is installed for IIS.

3. Apache installation (modular installation mode)

Take apache 2.0.55 as an example

(1) Download the apache installation package apache_2.0.55-win32 -x86-no_ssl.exe.

(2) Run the installation file you downloaded to install the apache installation file. You will be prompted to enter the host name, administrator mailbox and other information. This information can be modified in httpd.conf after installation, and you can enter it with confidence.

(3) In order to facilitate future operations, it is recommended to modify the default installation path. Here I changed it to "c:"

(4) After the installation is completed, you need to edit apache2/conf /httpd.conf file.

(5) Since IIS occupies port 80 by default, we need to modify the ServerName to "localhost:81" (line 213) and the port number to 81 (change listen 80 on line 120 to listen 81)

(6) Load the apache module PHP4apache2.dll supported by PHP, and add "LoadModule PHP4_module c:/PHP/sapi/PHP4apache2.dll" on line 134

(7) Load the supported suffix name and add "AddType application/x-httpd-PHP .PHP .PHP3 .PHP4" in line 757

(8) Add the default recognized PHP file name and find At line 322 where DirectoryIndex is located, add "index.PHP default.PHP default.htm default.html"

(9) Copy c:\PHP\PHP4ts.dll to c:\windows\system32 (must )

(10) Open the start menu->Run, enter the cmd command

(11)Enter the apache2/bin directory, run the apache –k install and apache –k start commands

(12) Visit http://localhost: 81 to display the APACHE welcome page (apache installation is successful)

(13) Put the PHP program to be debugged under apache2/htdocs, you can debug PHP program.

(14) You can also put the modified PHP debugger in a custom path and modify the DocumentRoot value of httpd.conf.

Configure the server's GD library support: 1. Open the PHP.ini file, find extension=PHP_gd2.dll, and remove the preceding semicolon (line 555)

2. Find extension_dir and modify "extension_dir = "./"" to the extensions directory where you installed PHP. Mine is extension_dir = "c:/PHP/extensions"

3. Just restart the apache server

The above is the detailed content of How to install iis php5.2. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to install php5.3Next article:How to install php5.3