Configuration of PHP + MySql in IIS

Source: Internet
Author: User

The execution efficiency of PHP is obvious to all, which is one of the reasons I like it. To integrate it with MySQL and Apache, which is called a wonderful partner, we can't help but wonder at its efficiency. PHP is also updated very quickly. The latest version php4.3.2rc4 is listed here (there are almost no bugs, and it is estimated that the official version will be available soon after the writing), and the installation process of the latest version mysql4.0.13.

PHP installation files can be directly to the http://www.php.net/download, get for win32.zip package (5.8 m)
MySQL installation files can be downloaded directly to the http://www.mysql.com, get for win32.zip package
In addition, if you want to experience the combination of Apache and PHP and want to give up IIS, please download the latest for win31. MSI installation package in http://www.apache.org, the latest version is 2.0.45.
In addition, you can download Zend optimizer to accelerate PHP. Specific access to http://www.zend.com

<1> install and configure PHP
1. decompress the PHP compressed package to C:/PHP (this path can be used at will, but please modify the path as follows ).
2. Copy all php4ts. dll and C:/PHP/DLLs files under the C:/PHP Directory to the Windows system folder. The folder varies with the Windows version.
For Windows 9x/Me, C:/Windows/System
C:/winnt/system32 for Windows NT/2000
C:/Windows/system32 for Windows XP/server2003
Here, C:/is the system disk of your current operating system. If your current operating system is not installed in C:/Windows, modify it accordingly.
Copy PHP. ini-Dist to C:/Windows/(XP/2003/9 x/ME) or C:/winnt/(2000/NT), and rename it PHP. ini. Open it in notepad and modify the following information:
Search the extension_dir =./line and point its path to the extensions directory under your PHP Directory, for example:
Extension_dir = C:/PHP/extensions
If you want to support more modules, follow these steps. If you don't want to, simply save the php. ini file.
PHP supports many modules, but some DLL files are not free of charge, so they are not released along with the PHP compressed package. However, there are many modules in the DLLs folder, we copied them to the System32 folder just now. Now we can test how many modules it supports. The following are my test results for your reference only. If the XXX. dll module is not supported in the pop-up after installation, you can simply add the semicolon (;) and search:
Windows extensions
; Note that MySQL and ODBC support is now built in, so no DLL is needed for it.
;
The following sections describe the supported extension modules with semicolons. If you want PHP to support a certain module, remove the previous ";". The following is the result of my test, it is normal to remove the comment as follows:
Extension = php_bz2.dll
Extension = php_c2.16.dll
Extension = php_crack.dll
Extension = php_curl.dll
Extension = php_db.dll
Extension = php_dba.dll
Extension = php_dbase.dll
Extension = php_dbx.dll
Extension = php_domxml.dll
Extension = php_exif.dll
Extension = php_fdf.dll
Extension = php_filepro.dll
Extension = php_gd2.dll
Extension = php_gettext.dll
Extension = php_hyperwave.dll
Extension = php_iconv.dll
; Extension = php_ifx.dll
; Extension = php_iisfunc.dll
Extension = php_imap.dll
Extension = php_interbase.dll
Extension = php_java.dll
Extension = php_ldap.dll
Extension = php_mbstring.dll
; Extension = php_mcrypt.dll
Extension = php_mhash.dll
Extension = php_mime_magic.dll
Extension = php_ming.dll
Extension = php_mssql.dll
Extension = php_msql.dll
; Extension = php_oci8.dll
Extension = php_openssl.dll
; Extension = php_oracle.dll
Extension = php_cmd.dll
Extension = php_pgsql.dll
; Extension = php_printer.dll
Extension = php_shmop.dll
Extension = php_snmp.dll
Extension = php_sockets.dll
; Extension = php_sybase_ct.dll
Extension = php_w32api.dll
Extension = php_xmlrpc.dll
Extension = php_cmdt.dll
Extension = php_yaz.dll
Extension = php_zip.dll
After the modification, save PHP. ini and install and configure PHP.

<2> install MySQL
MySQL is relatively independent. This database is very small and cannot be operated directly. It is not as intuitive as access or SQL2000. However, there are already a lot of software that can perform well on it, for example, phpMyAdmin and mysqlcc. These software can be downloaded from the http://www.mysql.com, which is not detailed here.
After downloading and obtaining the MySQL for win32installation package, open it with winzipand run setup.exe directly. Note that you should select an installation path. Of course, the installation path can be any, but I suggest installing it with PHP and selecting C: /MySQL directory. After the installation is complete, MySQL is complete. For setting users and passwords, you can use the two software mentioned above for management. The description is not continued here. The default username is root and the password is blank.
Usually after the installation of MySQL will automatically start the service, if not started, please run C:/MySQL/bin/mysqld-nt.exe

The next installation depends on what you choose as your Web server. I suggest using Apache. If you think it is in conflict with your IIS, use IIS directly.

<3> IIS configuration:
Open IIS, right-click on "Default web site" to open properties, and perform the settings shown in the following figure in the main directory. Note the steps:

Http://www.blueidea.com/articleimg/...32/iisphp_s.gif

After that, the IIS + PHP + MySQL environment is set up.

<4> if you do not have IIS, install Apache, a small Web Server:
We downloaded an MSI Installation File for Win32. After you double-click it, Apache installation is automatically executed. Follow the prompts to install it, the content to be written is based on your preferences, which has no effect. Of course, I suggest you And the PHP Directory to select the C:/directory, after installation, You Can See C:/apache2. After installation, the Apache icon is displayed in the system tray in the lower right corner of the desktop. You can double-click the Apache Control Panel to stop or restart the server.
Here we need to modify the C:/apache2/CONF/httpd. conf file and open it in Notepad:
Find:
# Namevirtualhost *
To:
Namevirtualhost 127.0.0.1
Find:

Modify the following lines:
Serveradmin (the Administrator mailbox you entered during installation)
DocumentRoot C:/apache2/htdocs
Servername apache2
Errorlog C:/apache2/logs/error_log
Customlog C:/apache2/logs/access_log common

Find:
Add
Type application/X-tar. tgz
Add the following two lines below:
Addtype application/X-httpd-PHP. php
Addtype image/X-icon. ICO
Find:
# Loadmodule ssl_module modules/mod_ssl.so
Add a row below:
Loadmodule php4_module C:/PHP/SAPI/php4apache2. dll
Add default files:
Find the directoryindex * line. You can add the default file name as follows:
Directoryindex index. php default. php index.htm index.html default.htm default.html
Save the file and restart the Apache server.

The PHP environment has been fully established.

<5> Zend optimizer installation (optional)
After the download is A. EXE file, you can install it directly. You must select the PHP version during the installation process. Here, I select PHP 4.3.x to check whether to back up PHP before installing. INI. Click OK and the installation will end.
Open PHP. ini and modify the following content:
Find:
[Zend]
You can see below:
Zend_optimizer.optimization_level = *
This line,
Change the value after = to 1023, that is, change this line
Zend_optimizer.optimization_level = 1023
After saving, it will be OK. Restart Apache/IIS and the installation is complete.

<6> test:
Create a file in notepad, write down the following lines, and save them to the C:/apache2/htdocs Directory, which is your site and directory named phpinfo. PHP. enter http: // localhost/phpinfo in the browser. PHP is enough ?.. PHP information.

Phpinfo ();

?>

Note that when you save the file, the file suffix should be. php. (Notepad will automatically add a. txt suffix after the file name, unless you take one of the following measures to avoid this situation .) When you save the file, the system will ask you to specify the file name. In this case, enclose your file name with quotation marks. (For example, "Hello. php ".) Alternatively, you can click the "Save type" drop-down menu in the "Save type" dialog box and change the settings to "all files ". In this way, you do not need to use quotation marks when entering the file name.
The above paragraph from the PHP Chinese manual, more detailed installation information, please download this Chinese manual http://www.php.net/docs.php, which has a variety of different systems installed in detail, but not very intuitive, some optimizations have not been written.

Below I will provide a few of the software to be used:
Php4.3.1 stable version:
Http://www.php.net/downloads.php

MySQL 4.0.13 stable version:
Http://www.mysql.com/downloads/index.html

Apache2.0.45 stable version:
Http://www.apache.org/dyn/closer.cgi

Zend optimizer:
Http://www.zend.com/store/products/zend-optimizer.php

In addition, php4.3.2rc4 contains the pear package, which is not found in php4.3.1. If you have downloaded the package, set the include path in PHP. ini and find the following two lines:
; Windows: "/path1;/path2"
; Include_path = ".:/PHP/shortdes"
To:
; Windows: "/path1;/path2"
Export de_path = "C:/PHP/Pear"
Save the file. This is the path of the PHP file. You can set multiple file paths. Use.

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.