The installation of PHP under Windows is simple, but if you don't pay attention to the method, you still get a headache. In addition, the PHP 5.2 version is somewhat different from the previous 4.x version, so it is necessary to keep a record of it and avoid the next time you forget the installation configuration method.
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>
<body>
<?php echo "Hello World"?>
</body>
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.
Installation and configuration of iis+php 5.2 under Windows