Windows IIS PHP 5.2 Installation and configuration method _php instance

Source: Internet
Author: User
Tags php debugger php windows sapi
Step one: Download the PHP 5.2 for Windows installation package and unzip to C:\php. Note that this decompression directory can be under any disk, however the directory name cannot contain spaces;
Here is the file directory for 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 two: The c:\php directory under the php.ini-recommended (or php.ini-dist file, the official recommendation for the former) copy to the current directory, and modify the file name is php.ini;

Step three: Edit PHP.ini. The following two lines of values are mainly modified:
Extension_dir = "C:\php\ext"
Doc_root = "C:\inetpub\wwwroot"

You need to delete these two lines at the beginning of the line; 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 four: Set the environment variables. Add the following values after path:
;:\ Php
Then restart the computer.

Step Five: Open Internet Information Services, locate the "Default Web Site", and stop the site. Then open the Properties page. In the Properties page, locate the Home Directory tab, click the Configure button, and add the application mappings. The values are:
Executable file: C:\php\php5isapi.dll
Extension:. php
The rest without modification, OK, restart the default website;

Step Six: Create a new file hello.php under C:\inetpub\wwwroot. Input content:


<title>World</title>






After saving, open the browser, enter the address: http://localhost/hello.php. If the page displays Hello World, the installation is correct. We can also view the source code of hello.php in the Web page, if there is no PHP code in the source code, it also indicates that the installation is correct.


Refer to a large number of other people's installation documents after their own summary of something, I hope that useful to everyone ....
1. PHP installation of two different modes ――cgi mode and modular installation mode
In CGI mode, if the client requests a PHP file, The Web server calls Php.exe to interpret the file, and then returns the result of the explanation to the client as a Web page, and in a modular way PHP is started and run with the Web server, so from a point of view, the Apache module installs PHP better security and better execution efficiency and speed than CGI mode.
The following examples are implemented in the Windows XP environment using php4.4.0 as an example.
1. Installation under IIS (ISAPI mode installation)
(1) Unzip the PHP package to C:\php\
(2) After renaming php.ini-dist to PHP.ini, copy to C:\Windows (Window 2000 copy to C \ Winnt)
(3) Copy the C:\php\php4ts.dll to the c:\windows\system32 (not necessarily required)
(4) configuration of IIS5.0. Open "Control Panel" = "Administrative Tools" = "Internet Service Manager".
Right click on "Default Web Site" and select "Properties".
Click on the "ISAPI Filter" tab, click "Add", select C:\php\sapi's Php4isapi.dll, the name is PHP.
Click the Configure button in the home directory and click Add in the Application Configuration dialog box. The Add/Edit Application Extension Mappings dialog box appears. Click "Browse" to select C:\php\sapi's Php4isapi.dll. extension. PHP, other default.
2. Installation under IIS (CGI mode installation)
(1) Download the PHP Windows Installer Php-4.4.0-installer.exe, the installer does not include any external PHP extensions (php_*.dll).
(2) Following the wizard step-by-step installation, the Setup Wizard collects enough information to set up the php.ini file and automatically configures the IIS server. (also available as Apache server, but not automatically configured, manual)
(3) Installation is done for IIS to install CGI mode PHP.
3. Apache Installation (modular installation mode)
Take Apache 2.0.55 as an example to illustrate
(1) Download Apache installation package Apache_2.0.55-win32-x86-no_ssl.exe.
(2) Run your downloaded installation files installed Apache installation files will prompt you to enter the host name, Administrator mailbox and other information, the information can be installed after installation in httpd.conf, can be assured input.
(3) In order to facilitate future operation, it is recommended to modify the default installation program path, here I changed to "C:"
(4) After the installation is complete, you need to edit the apache2/conf/httpd.conf file.
(5) Since IIS consumes 80 ports by default, we need to modify ServerName to "localhost:81" (213 lines) and port number 81 (120 lines of Listen 80 to listen 81)
(6) Load PHP supported Apache module Php4apache2.dll, add "LoadModule php4_module C:/php/sapi/php4apache2.dll" in line 134
(7) Load the supported suffix name and add "AddType application/x-httpd-php. php. php3. PhP4" To line 757.
(8) Add the default recognized PHP file name, find the 322 line where DirectoryIndex is located, add "index.php default.php default.htm default.html"
(9) Copy the C:\php\php4ts.dll to the C:\Windows\System32 (certain)
(10) Open Start menu, run, enter cmd command
(11) Go to Apache2/bin directory, run apache–k install and apache–k Start command
(12) Access http://localhost:81 display Apache Welcome page (Apache installation succeeded)
(13) Put the PHP program to debug Apache2/htdocs, that is, you can debug PHP program.
(14) You can also put the modified PHP debugger to the custom path, modify the value of the httpd.conf documentroot
Configure the server's GD library support:

1. Open php.ini file, locate Extension=php_gd2.dll, and remove the preceding semicolon (555 lines)
2. Locate Extension_dir and modify "Extension_dir ="./"" For you to install PHP in the extensions directory, my is Extension_dir = "C:/php/extensions"
3. Restart the Apache server to
  • 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.