Windows IIS PHP 5.2 Installation and configuration method _php instance

Source: Internet
Author: User
Tags openssl pear php code php debugger sapi
Step one: Download the PHP 5.2 for Windows installation package and extract it to C:\php. Note that this decompression directory can be under any disk, but the directory name cannot contain spaces;
The following is the php5.2 file directory:
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: Copy the php.ini-recommended (or php.ini-dist file, officially recommended) under the C:\php directory to the current directory and modify the file name to PHP.ini;

Step three: Edit PHP.ini. Mainly modify the values of the following two lines:
Extension_dir = "C:\php\ext"
Doc_root = "C:\inetpub\wwwroot"

You need to delete these two lines at the beginning of a change; The Extension_dir value is the ext directory in the PHP installation directory, and the Doc_root value is the home directory of the IIS settings;

Step four: Set the environment variable. After path, add the following values:
;:\ 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, and click the Configure button to add the application mappings. The values are:
Executable file: C:\php\php5isapi.dll
Name extension:. php
The rest does not need to be modified, after confirmation, restart the default Web site;

Step Six: Create a new file hello.php under C:\inetpub\wwwroot. Input content:
<title>World</title>
<body>
<?php echo "Hello World"?>

</body>
After saving, open the browser, enter the address: http://localhost/hello.php. If the page says Hello World, the installation is correct. We can also view the source code of the hello.php in the Web page, if the source code does not have PHP code, also shows that the installation is correct.


Refer to a large number of other people's installation documents after their own summary of a little things, hope for everyone useful ....
1. PHP installation of two different modes of ――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, the results are then returned to the client in the form of a Web page, and in Modularity, PHP is started and run with the Web server, so in a way, PHP is more secure and more efficient and faster to install than the CGI model in the Apache module mode.
The following examples are implemented in a Windows XP environment, taking php4.4.0 as an example.
1. Installation under IIS (ISAPI mode installation)
(1) Unzip the PHP compression package to the C:\php\
(2) Rename php.ini-dist to php.ini and copy to C:\Windows (Window 2000 copy to C:\ Winnt)
(3) Copy the C:\php\php4ts.dll to the c:\windows\system32 (not necessarily)
(4) IIS5.0 configuration. Open the Control Panel = "Administrative Tools" = "Internet Services Manager".
Right-click "Default Web Site" and select "Properties".
Click the ISAPI Filter tab, click Add, select C:\php\sapi php4isapi.dll, and name PHP.
Click the Configure button in the home directory to click Add in the Application Configuration dialog box to appear the Add/Edit Application Extension Mappings dialog box. Click "Browse" to select the C:\php\sapi php4isapi.dll. extension. PHP, other defaults.
2. Installation under IIS (CGI mode installation)
(1) Download PHP's Windows Installer Php-4.4.0-installer.exe, which does not include any external PHP extensions (php_*.dll).
(2) Following the step-by-step installation of the wizard, the Setup Wizard collects enough information to set up the php.ini file and automatically configures the IIS server. (You can do it as a server in Apache, but not automatically, you need to do it manually)
(3) Install the CGI mode PHP for IIS.
3. Apache Installation (modular installation mode)
Take Apache 2.0.55 as an example to illustrate
(1) Download the Apache installation package Apache_2.0.55-win32-x86-no_ssl.exe.
(2) Run your download installation files installed Apache installation files will prompt you to enter the host name, Administrator mailbox and other information, these information after installation can be modified in the httpd.conf, you can safely input.
(3) To facilitate future operations, we recommend that you modify the default installation program path, here I change to "C:"
(4) After the installation is complete, you need to edit the apache2/conf/httpd.conf file.
(5) Because IIS uses 80 ports by default, we need to modify the servername to "localhost:81" (213 lines) and the port number 81 (120 rows of Listen 80 to listen 81)
(6) Load PHP supported Apache module Php4apache2.dll, 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" on line 757.
(8) Add the default identified PHP file name, find DirectoryIndex 322 rows, 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 successful)
(13) Put the PHP program to debug under Apache2/htdocs, that is, you can debug PHP program.
(14) can also be modified PHP debugger to the custom path, modify the value of the httpd.conf DocumentRoot can be
Configure the server's GD library support:

1. Open the php.ini file, find the Extension=php_gd2.dll, and remove the preceding semicolon (555 lines)
2. Find Extension_dir and modify Extension_dir =./"" For you to install the extensions directory where PHP is located, mine is Extension_dir = "C:/php/extensions"
3. Restart the Apache server
Related Article

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.