Install and configure the apache + mysql + php runtime environment in Windows

Source: Internet
Author: User
Tags vc9

Although the apache + mysql + php environment is the best choice in linux, many friends have directly configured them on windows servers, next I will introduce the installation and configuration process.

The following describes the configuration of the flat php runtime environment in the wamp environment:

I. Preparations-download required software

• Apache httpd-2.2.22-win32-x86-openssl-0.9.8t.msi
• PHP php-5.2.17-Win32-VC6-x86.zip
• MySQL mysql-5.5.20-win32.msi

Ii. Install software

1. install Apache: Double-click to install Apache. It is no different from installing other Windows software. When you enter Server Infomation, there are no special rules as long as the entered information conforms to the format.

 

After the installation is complete, enter http: // localhost in the browser. If It Works is displayed !, Indicates that Apache is successfully installed.

2.Install PHP: Extract php-5.3.10-win32-vc9-x86.zip to a directory.

3.Install MySQL: Double-click the installation. To change the installation directory, select Custom in Choose Setup Type.

After the installation is complete, start configuring MySQL. Keep all the default options, but you 'd better change the default MySQL encoding to utf8. Set the password in the Modify Security Settings option and enter the password twice, click Execute to complete the configuration.

 

3. Integrate Apache + PHP + MySQL

Apache: first, modify the Apache configuration file so that Apache can parse the PHP file. The Apache configuration file is httpd. conf In the conf directory of the Apache installation directory.

1. Apache can parse the PHP file and find it in the configuration file.

# LoadModule vhost_alias_module modules/mod_vhost_alias.so add in the next line (the Green location depends on the directory where PHP is located)

 


LoadModule php5_module "D:/Develop/PHP/php5apache2_2.dll"
PHPIniDir "D:/Develop/PHP"
AddType application/x-httpd-php. php. html. htm


2. Find in the configuration file (change to parse the index. php file first by default)

Change DirectoryIndex index.html

DirectoryIndex index. php index.html 3. Modify the Apache site directory and find it in the configuration file (the directories installed in Apache are different and the displayed values are different)

DocumentRoot "D:/Develop/Apache2.2/htdocs" changed

Find DocumentRoot "D:/Workspace/PHP"

D:/Develop/Apache2.2/htdocs "> changed
D:/Workspace/PHP "> PHP: Rename php. ini-development to php. ini as the configuration file of PHP. Modify php. ini

1. Set the directory of the PHP extension package and find

; On windows:; extension_dir = "ext" to (the value is the directory of the ext folder)

; On windows: extension_dir = "D:/Develop/PHP/ext" 2. Enable the corresponding library function and find the row of the library to be enabled

; Extension = php_curl.dll
; Extension = php_gd2.dll
; Extension = php_mbstring.dll
; Extension = php_mysql.dll
; Extension = php_xmlrpc.dll remove the semicolon (comment), that is, change

Extension = php_curl.dll
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_xmlrpc.dll 3. Set the time zone and find

; Date. timezone = changed

Date. timezone = Asia/Shanghai is here, even if the configuration of a php running environment is complete, check whether the configuration is successful. Restart Apache, create the file index. php In the site directory, and enter the following content:


Phpinfo (); open the browser and enter http: // localhost. If the following content is displayed, the installation is successful and MySQL is associated.

The above process is the setup of the PHP runtime environment. During this process, I encountered the following problems:

1. If the Apache server service Cannot be started, the error "Cannot load D:/PHP/php5apache2_2.dll into server" is displayed.

Solution: The cause is that I use Apache Server 2.0.64, which is compiled under VC6. My current PHP version 5.4 is compiled in the VC9 environment. Compiling in different environments will make Apache Server unable to load the php module. In addition, Apache HTTP Server 2.0.64 cannot be opened after the installation is completed and restarted. It can run normally after being changed to Apache HTTP Server 2.2.

2. After the PHP environment is set up, the mysql_connect () function of php cannot be used to connect to the database.

Solution: copy the libmysql. dll and php5ts. dll files in the php decompression path to the System32 folder and restart Apache.

 

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.