Illustration of win2003+iis6+php+gd2+mysql installation configuration
Author:Eve Cole
Update Time:2009-05-30 20:08:12
Because more and more users are using Windows 2003 servers, and some high-quality programs are developed by PHP, this time we will talk about the installation and configuration of PHP under Windows 2003, as well as the setting of permissions under 2003 and other issues!
The installation of 2003 and iis6 will not be discussed here. If you do not know how to install win2003 and iis6, it is best to read other articles to learn how to install the system and components before reading the following!
######################
First: Install PHP
#####################
1. Download the php installation program http://www.php.net/downloads.php,
The latest version is php5.1. There are two ways to install PHP on Windows. One is the source code installation method, and the other is the exe installation method. The exe installation method is a fool-like installation. You can install it by double-clicking it. We will do it here. Let’s not talk about it anymore, let’s mainly talk about the installation of source code!
Downloading "PHP 4.3.10 zip package" or 5.0 or 5.1 is the same. Then unzip the downloaded zip file to
c:php (can be decompressed to different directories according to different needs, but the default is enough if you are not familiar with it, and it does not take up much space).
2. Copy c:phpphp4ts.dll to c:windowssystem32. (Sometimes for convenience, you can click to search for *.dll in the php folder and copy all the searched folders to system32, which saves a lot of trouble!)
Copy c:phpphp.ini-recommended (or php.ini-dist) to c:windowsphp.ini and then open c:windowsphp.ini and modify the following places:
; If the default 4096 is used, PHP performance will be very poor in IIS6
output_buffering = On
; If it is on a production server, you do not need to modify the following two lines.
error_reporting?=?E_ALL & ~E_NOTICE
display_errors = On (here is the error prompt for modifying php, off means no prompt, some database link non-error messages will also be output as error messages by php, it is recommended to be used to shut down the web server!)
; Indicates the folder where the PHP extension library is located
extension_dir="c:phpextensions" (this is the ext folder in php5, different versions are different, that is, the folder where the dll file is placed)
The following two are timeouts: generally 60-120
max_execution_time = 90
max_input_time = 90
post_max_size = 8M (6-10M is best)
upload_max_filesize = 8M (maximum upload attachment size)
default_socket_timeout = 90 (port time 60-120)
session.gc_maxlifetime = 3600 (default session survival time, seconds)
session.save_path = "C:PHPsessiondata" (Modify the session storage directory here. If you do not need the session function, you do not need to modify it. Note that the directory must exist. If it does not exist, it will be created)
Other settings can be modified according to your needs. After doing this, the first part is completed.
######################
Second: Configure PHP in IIS
#####################
1. First install IIS through the "Add or Remove Roles" function in the "Manage Your Server" wizard. In Windows Server 2003, IIS is called the "Application Server". If necessary during installation, you can select options such as ASP.NET. But even if it is not selected, it can be easily enabled in the future.
(Figure 02_01: Install IIS)
2. In the "Manage Your Server" wizard, click the "Manage this Application Server" connection to open the "Application Server" management window. Then select "Internet Information Services (IIS) Manager->Local Computer->Web Service Extensions" from the left. Then select any item on the right. Click the "Add a new web service extension" link.
Enter the extension and click the "Add" button to add the c:phpsapiphp4isapi.dll (sometimes the isapi file may also be under c:php) file to the list. Note that it is php4isapi.dll, not php4ts.dll.
Finally, select "Set extension status to Allow" and click the "OK" button to close the dialog box. You should now see the item you just added in the Web Services Extensions list.
(Note that this picture comes from the Internet, and the path in the picture is inconsistent with the path in this article! The same below)
(Note: PHP parsing is divided into two modes, cgi and isapi. If you choose php_cgi.exe here, it must be consistent in step 3!)
(Figure 02_02: Adding PHP4 extension)
3. Select "Internet Information Services (IIS) Manager->Website" from the left side of the "Application Server" management window. Then right-click the "Default Website" item and select "Properties" to open the "Default Website Properties" dialog box.
Switch to the "Home Directory" tab and click the "Configure" button to open the "Application Configuration" dialog box. Then click the "Add" button to open the "Add/Edit Application Extension Mapping" dialog box.
Click the "Browse" button, select c:phpsapiphp4isapi.dll, and set it according to the options in (Figure 03). The last step is "OK" to return to the "Default Website Properties" dialog box.
(Figure 02_03: Add application extension mapping)
4. Switch to the "Document" tab and click the "Add" button to add index.html and index.php to the default content document list. Finally confirm to close the dialog box.
(Figure 02_04: Add default document)
######################
Third: Verify installation
#####################
Use Notepad to write a few lines of code:
Save it as a phpinfo.php file in the root directory of the website. Then start the browser and visit http://xxx.aaa.com/phpinfo.php. If you see the following screen, it proves that the PHP installation is successful!
(Figure 03_01: Check whether PHP is installed successfully)
######################
Fourth: About permissions
#####################
Windows 2003 and other systems use the NTFS format for file installation, and under IIS6, different users can be assigned to each virtual host to access the website anonymously. If you have made the above settings, you may be prompted when testing the installation of PHP. Enter username, solution:
Please first confirm that the user accessing the virtual host has read and execute permissions on the website and directory!
On the corresponding virtual host under IIS management, you can view the properties of the right key, directory security tab, anonymous access and authentication control, and you can see the users allowed to access, and allow users to have read and write permissions on c:php
If there are multiple virtual hosts on your host, and each user uses a different user name to access the website, it is best to add all users to the same group and let the group have read and write permissions on the php folder!
After modification, the window prompting you to enter your username and password should be removed! !
######################
Fourth: mysql installation and gd2 support
#####################
First download the mysql installation file. The installation of mysql in win generally uses exe installation files, so the installation will not be introduced here!
PHP does not support reading mysql by default after installation. We need to modify the php.ini file and change
extension=php_mysql.dll
extension=php_gd2.dll
Remove the ";" in front. Note that in order for PHP to support generating true color pictures, it is generally required to support gd2. extension=php_gd2.dll is the dll file that supports gd2.
Note that versions before php5 do not support the password access format after mysql4.1 by default. Use the following command in Mysql to unify the password:
set password for 'username'@'hostname'=OLD_PASSWORD('password');
In this way, you can successfully connect to mysql! Or simply install php5 directly!
Thanks to the picture author!
If you have any questions, please advise!