Home >Backend Development >PHP Tutorial >Installation and configuration of IIS+PHP 5.2 under Windows_PHP tutorial
Although the installation of PHP under Windows is simple, it will still give you a headache if you don’t pay attention to the method. In addition, the PHP 5.2 version is also somewhat different from the previous 4.x version, so it is necessary to record it to avoid forgetting such an installation and configuration method next time.
Step 1: Download the installation package of php 5.2 for windows and unzip 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: Copy php.ini-recommended (or php.ini-dist file, the official recommendation is the former) in the c:php directory to the current directory, and change the file name to php.ini;
Step 3: Edit php.ini. Mainly modify the values of the following two lines:
extension_dir = "c:phpext"
doc_root = "c:inetpubwwwroot"
When modifying, you need to delete the ; comment at the beginning of these two lines. 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
and 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:phpphp5isapi.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:inetpubwwwroot. Input content:
Original source: http://www.cnblogs.com/hsapphire/