Windows Server 2003 IIS6 PHP Configurations

Source: Internet
Author: User
Tags php software phpinfo sapi mysql command line
The first step: the relevant software preparation (the following software is all until July 7, 2006)
PHP: Recommended Zip decompression version of Php-4.4.0-win32
4.4.0 version Download:
5.1.2 version Download:
5.1.4 version Download:
MySQL: Match PHP4 recommended MySQL5.0.22 's win system installation version
5.0.22 version Download: Http://
Official Download Address:
Zendoptimizer: The new version of the Better AH (currently the latest is 2.6.2)
Official Download Address:
(Although the download is free, but to register the user, can download, in order to facilitate the use of everyone, public I registered a good user name: ideacmblog password:, convenient for everyone to use, I hope everyone in the use of this account do not change the password and for other non-legitimate ways)
PhpMyAdmin: This, of course, is a new and better.
Official Download Address:
Domestic Download Address:

OK, the software download is ready, start installing now;
Assuming your system is c:\\, if your system is not c:\\ then please modify it yourself. At the same time, in order to avoid c:\\ because of the reinstall system and so on for various reasons, and in the system disk backup, transfer is also very inconvenient, so it is not recommended to install PHP software in c:\\, here I installed it in the d:\\php directory (this directory you can also set your own, If you want to install to a different tomb that involves modifying the path, modify the path below)

The second step: Install PHP (I take the PHP installation path to d:\\php\\php4\\ (to avoid confusion, php5.1.x version of the installation path to take d:\\php\\ php5\\)
(1), download the resulting, extract to d:\\php directory, will get two levels of directory Php-4.4.0-win32, renamed to PhP4, that is, to get PHP file storage directory D:\\PHP\\PHP4 \\[if it is PHP5.1.2, get the file is, directly to the D:\\PHP\\PHP5 directory can be stored in PHP file directory d:\\php\\php5\\];
(2), and then d:\\php\ Copy all DLL files under \PHP4 directory and d:\\php\\php4\\dlls directory [PHP5 to d:\\php\\php5\\] to C:\\Windows\\System32 (Win2000 system for c:/winnt/ system32/), if you have these DLL files in the directory, overwrite the existing DLL files,
(3), open d:\\php\\php4\\php.ini-dist with Notepad, and use Notepad's find function (ctrl+f) to search for and modify:
Register_globals = off
change off to ON, that is register_globals = on
Note: This corresponds to the PHP global variable function, consider a lot of PHP programs need global variable function so open, please note that the-php process The rigor of the order, if not recommended, is not modified to leave the default off state

Search again
Extension_dir =
and point its path to the extensions directory in your PHP directory, for example: Modify Extension_dir = "./" For extension_dir = "d:/php/php4/extensions/";
PHP extension function directory [PHP5 corresponding modified to Extension_dir = "d:/php/php5/ext/"]
Create a folder under d:\\php and name it tmp

; Upload_tmp_dir =
Upload_tmp_dir the comment character of the line, that is, the preceding semicolon ";", to make the line work in the php.ini document. Upload_tmp_dir is used to define the temporary path where the uploaded file is stored, where you can also modify and define an absolute path, where the directory must have read and write permissions.
Here I set the Upload_tmp_dir = D:/php/tmp (that is, the folder I created earlier)
Search to find

; Windows Extensions
Put some of the following common items in front of;

; Extension=php_mbstring.dll

; Extension=php_curl.dll

; Extension=php_dbase.dll

; Extension=php_gd2.dll
This is used to support the GD library, the general need, must choose

; Extension=php_ldap.dll

Remove the previous ";"
For PHP5 versions, you also need to find

; Extension=php_mysql.dll
And also remove the previous ";"
This is to support MySQL, because PHP5 MySQL as a standalone module to load the run, it is necessary to support MySQL must be selected

; Session.save_path =
To remove the front of the number, this article sets it to
Session.save_path = d:/php/tmp
Other you can choose to need to remove the front, and then save the file as PHP.ini to C:\\Windows (under Windows 2000 under the C:\\Winnt) directory, note that the file suffix is changed to ini, get C:\\windows\\php.ini (C:\\winnt\\php.ini under Windows 2000)

If the path and the same as this article can be saved directly to C:\\Windows (under Windows 2000 for C:\\WINNT) directory use if the path, etc. and the same as this article can be saved directly to C:\\Windows (under Windows 2000 for C:\\WINNT) directory use
Some friends often reflect the inability to upload large files or run some programs often time out, you can find C:\\Windows (Windows 2000 under the C:\\Winnt) directory php.ini The following content modification:
Max_execution_time = 30; This is the maximum time each script runs, you can modify the length, in seconds
Max_input_time = 60; This is the time that each script can consume, and the unit is the second
Memory_limit = 8M; This is the maximum memory consumed by the script and can be increased by itself
Upload_max_filesize = 2M; Upload the maximum license size of the file, change it yourself, some picture forum need this larger value

Fourth step: Configure IIS to support PHP
How IIS installs, then needless to say!
PHP supports CGI and ISAPI two installation modes, CGI consumes more resources, easily because of timeouts and not reflected, but actually more secure, load capacity, save resources, but the security is slightly worse than CGI, I recommend using ISAPI mode. Therefore, only the ISAPI mode installation method is described here:
In Control Panel, in Administrative Tools, select Internet Service Manager, stop the service after you open IIS, and for the Win2003 system, expand the subordinate tree for Internet Services Manager to select Web site for your computer name and right-click Properties. Select the ISAPI Filter tab on the Pop-up Properties window and click the Add button, and in the Filter Properties window that pops up, type: PHP, and then browse the executable to point the path to the path where Php4isapi.dll is located, as in this article: d:\\ PHP\\PHP4\\SAPI\\PHP4ISAPI.DLL[PHP5 corresponding path is D:\\php\\php5\\php5isapi.dll].
Open the Home Directory tab of the Site Properties window and locate and tap the Configure button
On the Application Mappings tab in the Application Configuration window that pops up, locate and click the Add button to create a new extension mapping, and in the pop-up window, click Browse to point the executable to the path where Php4isapi.dll is located, as in this article: d:\\php\\php4\\ SAPI\\PHP4ISAPI.DLL[PHP5 the corresponding path is D:\\php\\php5\\php5isapi.dll], the extension is. php, the action is limited to "Get,head,post,trace", the "script engine" confirms the existence of the file Select, and then make sure. If you also want to support PHP files such as. PhP3,. phtml, etc., you can repeat the "add" step, which is set to the desired extension. Phpx.
This step will enable all the sites under your server IIS to support the PHP extension file you added, of course, if you only need some site support PHP, just to "you need to support PHP Web site", such as "Default Web Site" Right-click "Select" Properties, in the Open "Web site Properties" " Home Directory tab, edit or add PHP extension mappings or delete the PHP extension mappings you need to support PHP in your site
Open the Documents tab of the Site Properties window, locate and click the Add button to add the index.php entry to the default Web site startup document list. You can raise the index.php to the highest priority so that when you visit the site, the index.php document is automatically found and opened first.
Determine the application settings for the Web directory and execute the license in the Select as pure script, and then close Internet Information Services Manager
For 2003 systems, you also need to set the ISAPI extension in Web Service extensions to the left of Internet services Manager to allow the Active Server Pages to allow
After all operations are complete, restart the IIS service.
Execute the following command at the cmd command prompt:
net stop w3svc
net stop IISAdmin
net start w3svc

To this, the basic installation of PHP has been completed, we have made the site support PHP script.
The check method is to create a new text file in the IIS root directory as php.php with the following contents:
Phpinfo ();
Open the browser, enter: http://localhost/php.php, will display the current server support PHP all the information, you can see the mode of the server API is: ISAPI.
Or use PHP probe detection, to download and extract to your site root directory and access to

Step three: Install MySQL
For MySQL4.0.26 download Get is, extract to Mysql-4.0.26-win32 directory double-click to perform Setup.exe all the way next, select Install directory as d:\\php\\ MySQL and installation method for custom installation, then all the way next next.
When the installation is complete, enter and run on the cmd command line:

If the service successfully installed is returned. System Services installed successfully
Create a new text file to save as My.ini, edit the configuration My.ini, here is a reference configuration

# The directory where the MySQL database is located can be changed to another directory where you hold the database
#language =d:/php/mysql/share/your language directory
#port =3306
set-variable = max_connections=800
set-variable = key_buffer=512m
Set-variable = max_allowed_ packet=4m
set-variable = table_cache=1024
set-variable = sort_buffer=2m
set-variable = thread_cache=64
set-variable = join_buffer_size=32m
set-variable = record_buffer=32m
set-variable = thread_concurrency=8
set-variable = myisam_sort_buffer_size=64m
set-variable = connect_timeout=10
Set-variable = wait_timeout=10
Server-id = 1
set-variable = key_buffer=128m
set-variable = sort_buffer=128m
Set-variable = read_buffer=2m
Set-variable = write_buffer=2m

Set-variable = key_buffer=128m
Set-variable = sort_buffer=128m
Set-variable = read_buffer=2m
Set-variable = write_buffer=2m

Copy this My.ini file to C:\\Windows (under Windows 2000 under C:\\WINNT) directory after saving
Go back to the cmd command line to enter and run:
net start MySQL
The MySQL service is starting.
The MySQL service has started successfully.
The MySQL service will start;
DOS Change root password: Of course, after installing phpmyadmin after the change password can also be modified by phpMyAdmin
Format: Mysqladmin-u username-P Old password password new password
Example: Add a password to root Ideacmblog
First, on the cmd command line, go to the bin directory under the MySQL directory, and type the following command
Mysqladmin-uroot Password Ideacmblog
Note: Because Root does not have a password at the beginning, the-p old password can be omitted.
D:\\php\\mysql\\bin>mysqladmin-uroot Password Ideacmblog Enter after the root password is set to Ideacmblog

If you are downloading mysql5.x or mysql4.1.x, example mysql-5.0.18-win32: Double-click to execute Setup.exe after the next step, next select Custom installation, next next select the installation path here we choose D:\ \php\\mysql, continue next next to skip sign up to complete the installation.

When the installation is complete, you will be prompted to configure it immediately, and select Yes to configure it. Of course, the General post-installation menu also has the Configuration Wizard MySQL Server Instance Config Wizar, after running, follow the steps below to configure and set the root password can be
Next Next Choose Standard Configuration
Next, tick the include: PATH
Next Next, set the root password, we recommend that the company set a complex point to ensure that the server security!
When apply is completed, the My.ini configuration file is generated in the D:\\php\\mysql directory, and the MySQL service is added and started

Fourth step: Install Zend Optimizer
After downloading to get zendoptimizer-2.6.2-windows-i386.exe, directly double-click the installation, the installation process when you choose Web Server, select IIS, and then prompt you whether Restart Web server, select Yes, If you are prompted to back up the php.ini before completing the installation, click OK and the installation is complete. I installed here to D:\\php\\zend

The following two-step directory is selected according to your own default Web site directory, and of course you can choose to D:\\php\\zend directory

The Zend Optimizer Setup Wizard automatically modifies the php.ini to help you start the engine based on your choices. The following is a brief introduction to the configuration options for Zend Optimizer. The following is the default configuration code in php.ini after the installation is complete (the content after the semicolon is commented):
Zend_extension_ts= "D:\\php\\zend\\lib\\zendextensionmanager.dll"
; Zend the installation path of the Optimizer module on the hard disk.
Zend_extension_manager.optimizer_ts= "d:\\php\\zend\\lib\\optimizer-2.6.2"
The optimizer is in the same directory as the default without modification.
, the degree of optimization, here defines how many optimization processes to start, the default value is 15, indicating the simultaneous opening of the 10 optimization process 1-4, we can change this value to 1023, which means that all 10 optimization process is turned on.
Called after the Phpinfo () function is displayed:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.9, Copyright (c) 2003-2006, by Zend Technologies and Zend Optimizer v2.6.2, Copyright (c) 1998-2006, by Zend Technologies indicates successful installation.

Fifth Step: Install GD Library
This step is removed in front of the php.ini configuration "; Extension=php_gd2.dll" in front of; it's actually installed.
[In php.ini find "Extension=php_gd2.dll" this line, and remove the preceding semicolon, the GD library installation is complete, with Echophpinfo (), Test success! ]

Sixth Step: Install phpMyAdmin
Download to get, unzip it to the d:\\php\\ or IIS root directory, Rename phpMyAdmin-2.8.2 to phpMyAdmin and create a new site in IIS or a virtual directory to point to the directory for Web address access, where the phpMyAdmin virtual directory that establishes the default site points to d:\\php\\ phpMyAdmin directory accessed through http://localhost/phpmyadmin/
Locate and open the config.default.php under directory D:\\php\\phpmyadmin\\libraries (phpMyAdmin2.7.0 and previous versions in d:\\php\\phpmyadmin\\ directory), Make the following changes:

$cfg [\ ' pmaabsoluteuri\ ']
Set your phpMyAdmin Web Access URL, as in this article: $cfg [\ ' pmaabsoluteuri\ '] = \ ' http://localhost/phpmyadmin/\ '; Note here that the phpMyAdmin is assumed to be at the root of the default site

$cfg [\ ' blowfish_secret\ '] =
Set the cookie encryption key, such as Ideacmblog set to $cfg[\ ' blowfish_secret\ '] = \ ' Ideacmblog\ ';
Search $cfg[\ ' servers\ ' [$i][\ ' auth_type\ '], the default is config, is unsafe, not recommended, the recommended use of cookies, set it to $cfg[\ ' servers\ ' [$i][\ ' auth_ Type\ '] = \ ' cookie\ ';
Note If this is set to config please set the username and password below! For example:
$cfg [\ ' servers\ '] [$i][\ ' user\ '] = \ ' root\ ';//MySQL user-----mysql connection user
$cfg [\ ' servers\ '] [$i][\ ' password\ '] = \ ' ideacmblog\ ';
Search $cfg[\ ' defaultlang\ '], set it to zh-gb2312;
Search $cfg[\ ' defaultcharset\ '], set it to gb2312;

Open browser, enter: http://localhost/phpMyAdmin/, if both IIS and MySQL are started, enter the user root password ideacmblog (if no password is set, the password is left blank) You can enter phpMyAdmin database management.
After entering the user name and password into http://localhost/phpmyadmin/, the client does not the support authentication protocol requested by server appears; Consider upgrading MySQL client error prompt,
This is because the password hashing algorithm used by MySQL 4.1 and its later version verification protocol is incompatible with the old client and therefore needs to be in MySQL Command line The client uses the command to synchronize the compatible password:
After entering MySQL command line client, MySQL prompt is:mysql>
and then executes:
SET PASSWORD for \ ' root\ ' @\ ' Localhost\ ' = Old_password (\ ' Your root admin password \ ');
can enter phpMyAdmin management, each new user to execute the command once, pay attention to replace root with your new user name and the corresponding password.
First click on permissions to enter user management, remove the root and host is not localhost and re-read user permissions table, here can also modify and set the root password, add other users and so on.
PhpMyAdmin The specific functions, please slowly familiar with, here do not repeat.

All installations are now complete.

Seventh Step: directory structure and secure directory permission settings in NTFS format:
The current directory structure is
+????? +?????? +??????? +??????? +
PHP4 (PHP5) tmp MySQL Zend phpMyAdmin
D:\\php is set to Full Administrator and system privileges, no other users have permissions
For the level two directory below
PHP4 (or PHP5), TMP to everyone full permissions
MySQL, Zend Administrator, and System full permissions
Phpmyadminweb Anonymous user Read run permissions

  • Related Article

    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: 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.