How to configure PHP5.2 and php5.4 in IIS

Source: Internet
Author: User
Tags apm

If you have been doing O & M for a period of time, you will know that we have requirements for the php version When configuring iis. If you are using php5.2, you can use the ISAPI for operations, for php5.4, you need to use FastCGI to enable iis to support php. I will introduce it below.

Install PHP5.2 in IIS

First, download the PHP installation file.
: Http://windows.php.net/download/

Here we download PHP 5.2 (5.2.14) Because PHP 5.3 (5.3.3) does not support ISAPI and FastCGI needs to be installed separately.

Here we use ISAPI as an example, So we download PHP 5.2 (5.2.14.

During the download process, VC6 x86 Non-Thread Safe and VC6 x86 Thread Safe are also divided. One is Non-Thread protection and the other is Thread protection. We recommend VC6 x86 Thread Safe because we use IIS's ISAPI and it is multi-threaded.

In the downloaded version, there are three more. Haha, some people are dizzy here. Why are there so many. I don't know which one to choose. ZIP is a compressed file. After decompression, You can manually install it. Installer is an msi file and you can double-click it to install it. Let's talk about manual installation.

The entire process is as follows:

1. Download the ZIP and decompressed D Drive in PHP.

2. Find the php. ini-dist file, copy it to c: windows, change it to php. ini, and copy php5ts. dll and libmysql. dll to C: Windowssystem32.

3. Open the renamed php. ini file in notepad, find extension_dir = "./", and change it to extension_dir = "D: phpext ".

4. In notepad, find "; extension = php_mysql.dll" and "; extension = php_gd2.dll", and then remove the preceding ";" to change extension = php_mysql.dll to extension = php_mysql.dll.
Remove the following content.
; Extension = php_mbstring.dll
; Extension = php_gd2.dll
; Extension = php_dbase.dll
; Extension = php_ldap.dll

5. Find; session. save_path = "/tmp" and remove ';'. Set the directory where you saved the session.
For example, session. save_path = "C: WindowsTemp ";

6. Find register_globals and change Off to On.

7. Find allow_url_include and change Off to On.

8. Save php. ini

The following is the design in IIS.

1. add a PHP extension first, as shown in "WEB Service extension" in IIS. Right-click the blank area on the right, and add the first extension. The extension is php. Select d for the required file: phpphp5isapi. dll, the following "set extension status to allow" is also selected. Click OK

2. Create a website in IIS, add it to the ISAPI filter, enter PHP as the Filter Name, select d: phpphp5isapi. dll as the executable file, and then click OK.

3. Finally, it is under the main directory. Click configuration, and then insert. Select d: phpphp5isapi. dll as the executable file, and write. php as the extension. The other files remain unchanged. OK.

4. The configuration is complete.

Install PHP5.4 in IIS

Download FastCGI 1.5 for IISX86/x64, add fastcgi http://www.iis.net/download/FastCGI ing


Edit C: WINDOWSsystem32inetsrvfcgiext. ini as follows:

Copy codeThe Code is as follows:
[Types]
Php = PHP

[PHP]
ExePath = D: phpphp-cgi.exe
Instancemax requests = 10000
EnvironmentVars = PHP_FCGI_MAX_REQUESTS: 10000


D: phpphp. ini is mainly modified as follows:


Output_buffering = On
Disable_functions = system, passthru, shell_exec, exec, popen, proc_open
Enable_dl = Off

Upload_tmp_dir = "D:/tmp/uploadtemp /"
Session. save_path = "d:/tmp/sessiondata /"
Date. timezone = "Etc/GMT-8"; represents GMT + 8
Mbstring. language = Neutral; Set default language to Neutral (UTF-8) (default)
Mbstring. internal_encoding = UTF-8; Set internal encoding to UTF-8


Cgi. force_redirect = 0
Cgi. fix_pathinfo = 1
Fastcgi. impersonate = 1


Refer to the configuration of the op accelerator and zend optimizer. do not enable xdebug when using it. Change the path to correct.


[Eaccelerator]
; Zend_extension = "/APM/ext/eAccelerator_v0_9_6_for_v5_2_13-VC6/eAccelerator. dll"
; Zend_extension = "/APM/ext/eAccelerator_v1_0_svn412_for_v5_2_13-VC6/eAccelerator. dll"
Eaccelerator. shm_size = "16"
Eaccelerator. cache_dir = "/tmp/eaccelerator"
Eaccelerator. enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. debug = "0"
; Eaccelerator. log_file = "/var/log/httpd/eaccelerator_log"
Eaccelerator. filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "300"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Eaccelerator. compress = "1"
Eaccelerator. compress_level = "9"

[Zend]
Zend_optimizer.optimization_level = 15
Zend_optimizer.encoder_loader = 0
; Zend_extension_ts = "/APM/ext/ZendOptimizer-3.3.0/lib/Optimizer-3.3.0/php-5.2.x/ZendOptimizer. dll"
; Zend_extension = "/APM/ext/ZendOptimizer_nts.dll"
; Zend_extension = "/APM/ext/ZendOptimizerPlus. dll"

The following is the reference configuration for using ZendExtensionManager. dll.
; Zend_extension_manager.optimizer_ts = "/APM/Zend/ZendOptimizer-3.3.0/lib/Optimizer-3.3.0"
; Zend_extension_ts = "/APM/Zend/ZendOptimizer-3.3.0/lib/ZendExtensionManager. dll"
; Zend_extension_manager.debug_server_ts = "/APM/Zend/ZendOptimizer-3.3.0/lib/ZendDebugger-5.2.13-cygwin_nt-i386"
; Zend_debugger.expose_remotely = always
; Zend_debugger.allow_hosts = 127.0.0.1/32
; Zend_debugger.allow_tunnel = 127.0.0.1/32
[ZendDebugger]
; It can be loaded at the same time as zend_optimizer.
; Zend_extension_ts = "/APM/ext/ZendDebugger-5.2.15RC1-cygwin_nt-i386/php-5.2.x/ZendDebugger. dll"

[Xcache-common]
; Zend_extension = "D:/APM/ext/XCache-1.3.0-php-5.2.10-nts-Win32-VC6-x86/php_xcache.dll"
; Extension = php_xcache.dll

[Xcache. admin]
Xcache. admin. enable_auth = Off
Xcache. admin. user = "mOo"
; Xcache. admin. pass = md5 ($ your password)
Xcache. admin. pass = ""

[Xcache]
Most of the options here can be modified only in ini. All options listed here are default values, unless otherwise stated
; Select low level shm/allocator scheme implemenation
Xcache. shm_scheme = "mmap"
; Disabled: xcache. size = 0
Enabled: xcache. size = 64 M (any value> 0). Pay attention to the upper limit of your system mmap.
Xcache. size = 0
We recommend that you set the number of CPUs (cat/proc/cpuinfo | grep-c processor)
Xcache. count = 1
; Is just a reference value, you can safely store more projects (php scripts/variables)
Xcache. slots = 8 K
; Cache item ttl, 0 = Permanent
Xcache. ttl = 0
; Interval between scanning expired items, 0 = No scanning, other values in seconds
Xcache. gc_interval = 60

; Same as above, only for variable cache settings
Xcache. var_size = 1 M
Xcache. var_count = 1
Xcache. var_slots = 8 K
; By default, ini_set () is allowed ()
Xcache. var_ttl = 0
; Maximum ttl value
Xcache. var_maxttl = 0
Xcache. var_gc_interval = 300

; For testing only
Xcache. test = Off
;/Dev/zero is invalid
Xcache. readonly_protection = Off
For * nix systems, xcache. mmap_path indicates the file path rather than the directory (it may not exist but must be created ).
If you want to enable ReadonlyProtection, you can use "/tmp/xcache"
; Two php groups will not share the same/tmp/xcache
For Win32 systems, xcache. mmap_path = anonymous MAP Name, not the file path. We recommend that you use XCache to avoid conflicts with other software.
Xcache. mmap_path = "XCache"


; Only for * nix Systems
; Set to null (disabled) or similar to "/tmp/phpcore /"
; Note that this directory should be able to be written to a file by php (not related to open_basedir)
Xcache. coredump_directory = ""

Xcache. cacher = On
Xcache. stat = On
Xcache. optimizer = Off

[Xcache. coverager]

If xcache. coveragedump_directory is set to null, this setting is automatically set to Off
Xcache. coverager = Off

; Make sure that this directory can be read by the coverage viewer script (Note: open_basedir)
; Dependent On xcache. coverager = On
Xcache. coveragedump_directory = ""

[Xdebug]
Xdebug. var_display_max_depth = 10
; Xdebug. remote_autostart = 1
; Xdebug. remote_enable = 1
; Xdebug. remote_handler = dbgp
; Xdebug. remote_host = 127.0.0.1
; Xdebug. remote_mode = req
; Xdebug. idekey = default
; Xdebug. remote_log = "/xdebug. log"
; Xdebug. remote_port = 9000
Xdebug. auto_trace = off
; Xdebug. collect_params = on
; Xdebug. collect_return = on
Xdebug. trace_output_dir = "/tmp/xdebug"
Xdebug. profiler_enable = off
Xdebug. profiler_output_dir = "/tmp/xdebug"
; Zend_extension_ts = "/APM/ext/xdebug/php_xdebug-2.0.5-5.2.dll"
; Zend_extension = "/APM/ext/xdebug/php_xdebug-2.0.5-5.2-nts.dll"
Zend_extension = "/APM/ext/xdebug/php_xdebug-2.1.0beta3-5.2-vc6-nts.dll"


The following is an alternative solution for configuring the PHP environment.

Copy codeThe Code is as follows:
ISAPI Method
Download php and decompress it to d: php to set the permissions of administrators and system, and read and run every.
Add the environment variable PHPRC = D: PHP to set the path for loading the php. ini file.

 

 

Add path to d: php uses the relevant dynamic link library

Add extensions and set them to allow.

Add php ing

Edit the php. ini file and restart IIS. End

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.