Usually help friends to configure a few PHP environment server, but has been using Apache http+php, today, I iis+php configuration way for everyone to send under ~ hehe.
Here, I am using the FastCGI module mapping configuration, and of course the ISAPI handler mapping, but the way ISAPI is PHP5.5 after the fastcgi is the recommended way, the efficiency is relatively high and stable.
System I use my own notebook, Windows 8.1,iis is 8, of course, Windows Server is the same, follow the line.
Demo Environment:
- Windows 8.1
- IIS 8
- PHP 5.6.4
Process:
- Open the system's IIS platform
- Select Download PHP Environment
- Configuring the PHP Environment
- Enable PHP support for IIS
- Test your PHP environment
1. Open the system's IIS platform
Except for Windows Server systems, IIS is turned off by default and needs to be turned on manually.
Open the Uninstaller panel, click "Turn Windows features on or off" on the left, and then open the Windows features window:
Then, find "Internet information Service" (IIS) and expand, tick all the items (there are actually many options that we don't use, and what Tick is OK):
Wait for enable, when finished, run the cmd command "inetmgr" to open the IIS Admin Panel:
On the left side of the site there will be a default site, "Default Web site", which is automatically started, we access "http://localhost", will display the IIS 8 welcome interface, indicating that IIS enabled successfully:
2. Select Download PHP Environment
To the PHP website to download the PHP environment of the Windows environment, the latest version is "PHP 5.6 (5.6.4)", is also my demo environment.
However, there are four options under the official website:
-
- VC11 x86 Non Thread Safe (2014-dec-18 00:06:50)
- VC11 x86 Thread Safe (2014-dec-18 00:01:59)
- VC11 x64 Non Thread Safe (2014-dec-18 00:02:02)
- VC11 x64 Thread Safe (2014-dec-18 00:02:02)
"Non thread Safe" is a non-thread-safe version, and "Thread safe" is a thread-safe version.
FastCGI is executed in a single thread, so there is no need for thread security checks, and the removal of thread safety checks can improve execution efficiency. This time we are configured by fastcgi way, so choose "Non Thread Safe" version of the environment, x86 is 32 bit, x64 is 64 bit, this need not say more.
My system is Windows 8.1 x64, so here I choose "VC11 x64 Non Thread Safe (2014-dec-18 00:02:02)", click Download, download here I will extract to "C:\PHP5" this directory.
3. Configuring the PHP Environment
Go to the PHP directory just unzipped, my is "C:\PHP5", the "php.ini-development" file copy, renamed "PHP.ini", this as a PHP environment configuration file.
Open the editor with Notepad, search for "Date.timezone", find ";d Ate.timezone =" and edit as: "Date.timezone = Asia/shanghai, as follows:
There are also the following settings, which you can search for with the same settings as above:
- Register_globals = on # turn on Get data call
- Short_open_tag = on # PHP supports short tags
- Cgi.force_redirect = 0 # enable CGI to execute PHP
- Fastcgi.impersonate = 1
- Cgi.rfc2616_headers = 1
Then, locate the following extension options, removing the preceding semicolon (enabled):
- ; Extension=php_gd2.dll
- ; Extension=php_curl.dll
- ; Extension=php_mbstring.dll
- ; Extension=php_exif.dll
- ; Extension=php_mysql.dll
- ; Extension=php_mysqli.dll
- ; Extension=php_scokets.dll
- ; Extension=php_pdo_mysql.dll
Remove the following:
Then search for "Extension_dir", remove the preceding semicolon, and specify the PHP environment extension files in the directory, that is, to download the Ext folder in PHP, such as my:
Finally, save and copy this "php.ini" to "C:\Windows".
4. Enable PHP support for IIS
Go back to the IIS Admin Center, click on the target website and find "handler mappings" on the right:
Open "Handler mapping", click on the right side of the "Add Module mapping", pop-up Module Mapping Settings window, name input "*.php", module Select "Fastcgimodule", execute the program select the PHP directory you just downloaded configuration "Php-cgi.exe", and finally determine:
Then, click on the website, on the right side of "default document", Add php Default page "index.php" entry:
5. Test your PHP environment
Open the IIS management platform, right-click on the left just configured site, browse the folder, create a new "index.php", enter the following code:
1 <? PHP 2 Phpinfo (); 3 ?>
Then, visit "http://localhost/index.php" to see the PHP Information page:
By this, all configurations are complete! Oh.
Because the previous PHP environment is the MSI installation version, the system environment is missing things will be automatically installed online, can also be manually interface configuration, but now is the decompression version of the, so, sometimes there may be some problems, but are small problems, Baidu has a lot.
For example, a common problem: Php.exe can not run or have no access to what, is the system needs to install "Visual C + + redistributable for visual Studio Update 4 (x64)" and "Visual C + + Redistributable for Visual Studio Update 4 (x86) ".
The above demo if there is something missing forget to write, please leave a message to explain, if need what software can not find, message, software I have already uploaded network disk.
Well, the code word is not easy, I think it is good to remember a praise Oh ~ hehe.
IIS8 using fastcgi to configure the PHP environment support process