win2008 R2 down Iis7.5+php5.2.17+mysql5.5.16+zend3.3.3_win server

Source: Internet
Author: User
Tags file copy garbage collection session id php and mysql versions phpmyadmin zend microsoft iis

Objective

Under Windows Server 2008 R2 IIS7.5 has greatly improved support for fastcgi, and friends who are using PHP-ISAPI mode can try.

In view of the current php5.3.1 still can't perfect support mainstream PHP system, do not recommend everyone to use!

windows2008 Server R2 under the environment to build three kinds of circumstances, we can according to their own operation needs to choose.

1, Iis7.5+php+mysql+wincache 1.0RC

This environmental mix has already been seen without Zend.

Each version is:

php5.2.17– Please note that the non-thread safe version of PHP 5.2.17 Non-thread-safe Zip package

MYSQL5.0 x64,

WINCACHE1.0RC for5.2, this everyone can go to Microsoft IIS official download, he will greatly improve the efficiency of your system!

If your server is running open source programs, do not need to Zend, we strongly recommend that you use this configuration!

2, Iis7.5+php+mysql+zend+xcache

This composite version is:

Php-5.2.17-win32-vc6-x86.zip PHP Please note that the thread safe version

Mysql-essential-5.0.91-winx64.msi

Zendoptimizer3.3.3-windows x86

Xcache1.3 for Xcache-1.3.0-php-5.2.17-win32-vc6-x86.zip

This combination can perfectly run today's mainstream PHP system, but the drawback is that using PHP thread safe version can not load Wincache, unfortunately! But you can use XCache as a supplement, but it's much better than PHP-ISAPI mode!

3, in view of the new characteristics of IIS7.5, can be customized according to the specific situation of each site belongs to his proprietary operating environment!

In iis7.5 fastcgi mode, IIS officially recommends a separate application pool for each site, and each site can have its own php.ini and Fastcgi.exe. Allows you to run different versions of PHP on a single host. [1]

[1] The above content is quoted from the network.

[2] Windows 2008 R2 has only X64 version/windows 2008 has X86 and X64 versions/windows 7 has X86 and X64 versions; The following tutorials are also supported for the previous two X86 versions and only need to replace the MySQL counterpart version.

Prep Program

Select the following versions to be aware of MySQL under the 2008r2 can choose 64-bit, PHP VC9 is for IIS, VC6 for Apache, thread-safe and unsafe version of this choice is a thread-safe version, PHP thread-safe version can not load Wincache, So we use XCache as an alternative, and if we want to use Wincache to choose a non thread safe version,

1.mysql-essential-5.0.91-winx64.msi
2.php-5.2.17-win32-vc6-x86.zip
3.zendoptimizer-3.3.3-windows-i386.exe
4. Xcache1.3.2for-php-5.2.17-win32-vc6-x86.zip
5.phpmyadmin-3.3.10.-all-languages.zip

Installation Configuration Path Planning
MySQL D:\service\ MySQL
PHP D:\service\ PHP
Zend D:\service\ Zend
Mysqldatebase D:\service\ Mysqldatebase
WEB Directory D:\WEB\ZTGPS

The following tutorials are fully illustrated, partially optimized, fully tested, the main debugging environment Windows 2008 R2 SP1 Server has installed components Net.fromwork 4+vc2008x64, tutorials are not welcome to explore.

First, install the configuration MySQL

Second, install the configuration IIS7.5

Third, install the configuration php

Iv. IIS7.5 Configuration fastcgi

V. Installation of Zendoptimizer

Vi. XCache Installation and configuration

Seven, Web page compression configuration

Viii. Configuration of phpMyAdmin

Nine, Empirebak v2010 Empire Backup

Ten, static installation configuration

Xi. Other Matters

First, install the configuration MySQL


(1), double-click Mysql-essential-5.0.91-winx64.msi

NEXT

Select Custom Installation:

Next

Click "change" to modify MySQL installation directory:D:\service\ mysql
After the file copy installation completed, the MySQL setup interface, click Finish:

NEXT

The following selections appear

Select detailedconfiguration(Detailed configuration):

NEXT

The following selections appear

Select MySQL run mode:Server Machine:

NEXT

The following selections appear

Choose MySQL Database Default storage mode:non-transactional DB only
Then select this option. NEXT

The following selections appear

· Manual Setting(Manual setting): Select this option to manually set the maximum number of concurrent server connections. Select the number of concurrent connections from the previous Drop-down box, and if the number you expect is not in the list, enter the maximum number of connections in the Drop-down box.

Set the maximum number of MySQL connections: General set to 128-512 between the integers:
NEXT

The following selection of enable Strict Mode appears so that MySQL does not allow for minor grammatical errors.
It is recommended that you cancel the standard mode to reduce trouble. But after familiarity with MySQL, use standard mode as much as possible, because it reduces the likelihood that harmful data will enter the database.
NEXT

The following selections appear
Change the default character set for the MySQL server using the Manual Selected default Character set/collation(Character Set dialog box).
Please select the default character set you want, and choose GBK in mainland China.
NEXT

The following selections appear

To install the MySQL server as a service and start automatically, check the launch the MySQL server automatically option

Service name default MySQL on line

Include Bin Directory In Windows Path This is also selected
NEXT

Modify the Set root user password, note: Do not start remote connection mode!
turn enable root access from remote machines
Create an anonymous the two cancellation options

NEXT Install
complete MySQL installation, will automatically start the MySQL service.

(1) test whether the MySQL work is normal.

Open the cmd Command Prompt window and enter the command:mysql–u root–p

Enter the password, if the normal access to the MySQL console, the MySQL installation is normal.

Change MySQL database directory

A) Open the cmd Command Prompt window, enter the command:net stop mysql server running MySQL service;

b) Open D:\ Service\mysql\my.ini

Found it:

DataDir = "D:\ service\mysql\data"

Modified to:

DataDir = "D:\Service\ mysqldatabase"

(c) Copy the contents of the D:\Service\MySQL\data folder to the D:\Service\MYSQLDatabase;

D Open the cmd Command Prompt window, enter command:net start MySQL to start MySQL service.

e re-test whether MySQL is working properly.

(3) Prepare libmysql dynamic link library

Will D:\Service\MySQL\bin\ directory under the LibMySQL.dll, Libmcrypt.dll, Php5ts.dll(if not libmcrypt.dll,php5ts.dll These two files please go to the PHP directory to extract the 3 files copied to C:\Windows\System32.

  Note: My.ini above "Basedir" is the installation directory pointing to MySQL, "DataDir" point to MySQL data storage directory.

MySQL is now installed

Third, install the configuration php

Open Php-5.2.17-win32-vc6-x86.zip

Unzip the files in the PHP package to the D:\Service\PHP folder and rename the Php.ini-dist to php.ini.

Open the php.ini file,

Find: Extension_dir = "./"

change it to;

Extension_dir = "D:/service/php/ext"

Extension_dir is the directory that holds the extension library (module), which is the directory that PHP uses to find the dynamic extension module.

Find Post_max-size= 8M

Modified to 30M

Found: Windows Extensions

In the dynamic module configuration under Windows extensions, you need to open the following module support: (remove the module configuration before each line;

Extension=php_gd2.dll, GD library support, if you do not open the module then discuz! forum image Watermark can not be used.

Extension=php_mcrypt.dll, better support phpMyAdmin not selected, there will be "unable to load mcrypt extension

Extension=php_mbstring.dll, open mbstring, do not choose words with phpmyadmin will appear red hint.
Extension=php_mysql.dll, support MySQL.

Extension=php_pdo.dll,

Extension=php_pdo_mysql.dll,
The preceding semicolon is removed so that PHP can support these extensions,

What additional functions to open can be modified as needed later. PHP.ini can be backed up, and the system can be used directly after reloading.

8, configure the Session.save_path path

Change the Session.save_path path to d:/service/php/tmp (note that there are several paragraphs of this text, select the directory location below, which requires manual setup and open read and write permissions)

Session.save_path Advanced Configuration and other instructions, translated from php.ini configuration file

You can use "N;" [MODE;] /path "This pattern defines the path, and N is an integer that represents a subdirectory with an n-level depth, rather than keeping all data files in one directory.

[MODE;] Optionally, you must use the 8 number and the default 600 (=384) to represent the maximum number of session files saved per directory. [MODE;] Does not overwrite the umask of the process. PHP does not automatically create these folder structures. Can be created using the mod_files.sh script in the Ext/session directory. If the folder can be accessed by insecure users (such as the default "/tmp"), a security vulnerability will be created. Automatic garbage collection will fail when n>0, as detailed in the garbage collection section below.

If you have multiple virtual hosts on your server, it is recommended that you set up separate directories for each of the different virtual hosts.

At this point the most basic session configuration is complete, you just save php.ini, restart IIS, you can use the session function.

Additional session configuration Instructions

Session.save_handler = "Files"

Default file access to session data, if you want to use a custom processor to access session data, such as databases, with "user".

Session.use_cookies = 1

Whether to use cookies to save session SessionID on the client, default to adopt cookies

session.use_only_cookies = 0

Whether to save session SessionID on the client only using cookies, this option allows the administrator to prevent the user from passing the ID through the URL, the default is 0, and if disabled, the client will prevent sessions from working if the cookie is disabled.

Session.name = "Phpsessid"

Session ID name to use as cookie name

Session.auto_start = 0

Whether to start the session automatically, the default does not start, we know that when using the session function, we basically in each PHP script head will be through the session_start () function to start the session, if you start this option, The session is automatically started in each script header, without the need for each script header to start session with the Session_Start () function, which is recommended to turn off this option and use the default value.

Session.cookie_lifetime = 0

Passing SessionID cookie validity (in seconds), 0 means only valid during browser opening.

session.gc_probability = 1

Session.gc_divisor = 100

Defines the probability of starting the garbage collector each time the session is initialized. The formula is as follows: Session.gc_probability/session.gc_divisor, such as 1/100, means that there is a 1% probability to start the garbage collector, the more frequent access to the session page, the probability should be smaller. The recommended value is 1/1000~5000.

Session.gc_maxlifetime = 1440

Sets the lifetime of the saved session file, and after this parameter is set seconds, the saved data is considered ' garbage ' and cleaned up by the garbage collector. The criterion is the last time the data is accessed (for the FAT file system is the last time the data was refreshed). If multiple scripts share the same Session.save_path directory but session.gc_maxlifetime differ, the minimum values in all session.gc_maxlifetime directives are the same.

If you set up a subdirectory to store the session data file in the Session.save_path option, the garbage collector does not start automatically, and you must use your own shell scripts, cron entries, or other methods to perform garbage collection.

For example, set "Session.gc_maxlifetime=1440″ (24 minutes):

Cd/path/to/sessions; Find-cmin +24 | Xargs RM

These are some common session configuration options, and more session configuration options indicate that you can refer to the instructions in the php.ini file.

Next, some file uploads and maximum memory usage restrictions are modified:
Search Resource Limits
Locate the following modifications:
Max_execution_time = 30; Here is the maximum time for each script to run, you can modify the lengthened, unit seconds.
Max_input_time = 60; Here is the time each script can consume, and the unit is also seconds.
Memory_limit = 128M; This is the maximum amount of memory that the script runs to allow itself to be configured according to its own machine.
Search Upload_max_filesize
Upload_max_filesize = 2M Here is the maximum allowable size of uploaded files, online upload of picture stations, forums and so on may need to set larger, self modification.

Now that the basic PHP configuration is complete, save the php.ini file and copy it to C:\Windows\

By the way, don't forget to change register_globals = off to Register_globals = on.

Iv. IIS7.5 Configuration fastcgi

Open the php.ini in the PHP directory to find: Extension_dir = "./"

Here is the PHP extended directory to check if the following extension_dir = "D:\service\php\ext\"

Configure parameters by diagram:

Save and Close!

Next, Hook up PHP to IIS

Open IIS Manager, locate: Handler mappings, open the following diagram and click Add Module map:

The image above is referenced from the network, and the executable file location can be replaced with D:\service\php\php-cgi.exe.

When you are sure you are prompted to create the FastCGI application, click Yes.

At this point, go back to the IIS features view, find: "FastCGI settings", open and follow the diagram

To add file monitoring and environment variables: php_fcgi_max_requests, the value is set to 10000:

Adding file monitoring for PHP.ini can restart IIS after modifying the PHP configuration and allow the changes to take effect in real time!

Enter the D:\web\ZTGPS directory and create a new phpinfo.php file, which reads:

<?php

Phpinfo ();

?>

If loading fastcgi not successful click-Application pool-then DefaultAppPool application pool-Select advanced Settings

Select True after enabling 32-bit applications

Install Zendoptimizer

The installation process is very friendly and relatively simple, so there is no screenshot here. However, the following points need to be noted:

(1) Zend Optimzer installation directory to be designated as D:\Service\Zend;

(2) In the installation process prompts the location of the php.ini, pay attention to see if it is C:\Windows, if not must be manually designated as the php.ini location, or by default, you have just configured the php.ini copy to the Windows directory. (3) The location of the root of the IIS Web site prompted during installation, specified as: D:\WEB also both you store the total directory of the site Zend Optimizer will automatically restart the IIS service after the installation completes, you will need to open the IE browser window again after the reboot to view the phpinfo.php support information To see if the Zend Optimizer support information is included, if not, then Zend Optimizer is not installed successfully!

After the default installation is completed, you can not directly support Zend encryption, you need to do special settings. The following explains how to configure

Zend, and let PHP support to return to the desktop, on the "My Computer" above the right button, click "Properties" and then appear the window, and then click on the right-hand side of the "Advanced system Settings" and then click on the "Environment variables" below

Double-click to open the Edit Path variable window, the default is this%SYSTEMROOT%\SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%\SYSTEM32\WBEM;%SYSTEMRO

Ot%\system32\windowspowershell\v1.0\

Then add the following

;D: \service\zend\lib;d:\service\zend\lib\optimizer-3.3.0\php-5.2.x

You can also specify PHP and MYSQL to add a directory of support libraries to facilitate the use of PHP–V to debug PHP loading;D: \service\mysql\bin;d:\service\php;d:\service\php\ext Add this line (according to the Already installed file path to fill in yourself)

All the way OK

Reboot system

You need to reboot the system to make the variable value effective.

Note: If your Zend version and PHP version are different from what I have demonstrated, the path above may change, please modify the file path

Now that the Php,mysql,fastcgi,zend configuration has been completed, if not unexpected, then your IIS 7.5 can support the above environment please use the PHP probe program or PHPINFO. PHP to see if the configuration was successful. If OK

It's okay to see the following information

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.