Build a php development environment using apache in windows

Source: Internet
Author: User
Tags php development environment php website vc9
This topic describes how to use apache2.2.21php5.3.5mysql5.19phpmyadmin3.4.9 to build a php development environment in Windows2003. This topic describes how to use it.

This article describes how to use Apache2.2.21/PHP5.3.5/Mysql5.5.19/phpMyAdmin3.4.9 to build a php development environment in Windows2003. This article describes how to use it in detail.

This article describes how to use Apache2.2.21/PHP5.3.5/mysql5.19/phpMyAdmin3.4.9 to build a php development environment in Windows2003.

Step 1: Download the installed file

1. Apache version httpd-2.2.21-win32-x86-no_ssl.msi.

2. MySQL version mysql-5.5.19-win32.msi.

3. PHP version of php-5.3.5-Win32-VC6-x86.zip

4. phpMyadmin version phpMyAdmin-3.4.9-all-languages.zip

Tip:

1. We recommend that you select an Apache version without SSL functionality to complete development, so we use Apache 2.2.21-win32-x86-no ssl. msi here.

2. Install MySQL under Windows select. msi installation package format, we select the mysql-5.5.19-win32.msi, double-click according to the Wizard to install, simple and convenient.

3. php we choose to use Windows. Zip, php-5.3.5-win32-vc6-x86.zip. In terms of security and performance, both the zip version is good, and generally the server is installed with this version.

Do not download the default or VC9 version, because VC9 is customized for IIS, and VC6 is provided for Apache or other WEB service software.

4. phpMyAdmin is an online MySQL management tool based on PHP. The PHP environment required for phpMyAdmin3 installation must be at least PHP5.2 and MySQL 5 or later. We have met the requirements here.

Step 2: Install the file

1. Create a folder on the disk to be installed. To facilitate management, create a WAMP folder under the root directory of drive D. D: \ WAMP (WAMP is short for windows + apache + mysql + php ).

2. Create a WWW folder under the WAMP folder to store your PHP website programs. D: \ WAMP \ WWW.

3. Install the Apache server and install the Apache server in the D: \ WAMP \ Apache folder. For details about how to install Apache, refer to the Apache installation diagram.

4. decompress the downloaded php-5.3.5-Win32-VC6-x86 to the d: \ WAMP \ PHP folder.

5. Install the MySql database and install MySQL in the D: \ WAMP \ MySQL folder. For details about the MySQL installation process, refer to the MySQL installation diagram.

6. Decompress phpmyadmin-3.4.9-all-languages.zip, rename it phpMyAdmin, and copy it to the PHP website program directory. The result is D: \ WAMP \ WWW \ phpMyAdmin.

Step 3: Configure Apache

Use the text editing tool (EditPlus recommended) to open D: \ WAMP \ Apache \ conf \ httpd. conf file, which is the Apache configuration file. The following steps are all about modifying the file content.

Note that you must restart the Apache service after modifying the httpd. conf file. The new settings will take effect.

1. Set the listening port

Open the httpd. conf file, find the Listen (probably in the 46th rows), and change the number following it to 8080, as shown below:

Listen 8080.

This parameter is used to set the listening port of the Apache server. The default value is 80. To avoid conflict with the IIS port number in Windows 8080, you can use the default port number 80 if you have not enabled IIS.

2. Let Apache load the PHP Module

Find # LoadModule vhost_alias_module modules/mod_vhost_alias.so (approximately 128th rows) and add the following content after this line:

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

This statement loads the PHP5 module in module mode.

AddType application/x-httpd-php. php


The file with the. php extension is executed as a php script. You can use any other extensions you like, such as. html,. php5, or even. txt, to execute PHP.

PHPIniDir "D:/WAMP/PHP"

This statement is used to specify the directory where the PHP configuration file php. ini is located.

If Apache 2 runs php5 in the module mode, you can use the PHPIniDir command.

3. Modify the website storage directory

We know that the default website directory of Apache is the htdocs folder under the Apache installation directory. When you change the website storage directory, you must modify the corresponding Apache configuration.

In the configuration file httpd. conf, find DocumentRoot (probably in line 182) and change it to the correct folder pointing to the website directory. Here we change

DocumentRoot "D:/WAMP/www"

At the same time, find This shoshould be changed to whatever you set DocumentRoot to (approximately 207 rows), and there is a line below it Modify the DocumentRoot path configured for you. Here we modify it:


4. Modify the home page file of the Directory

In the configuration file httpd. conf, find DirectoryIndex index.html (approximately 244 rows) and change it:

DirectoryIndex index.html index.htm index. php

DirectoryIndex refers to the default file executed by Apache when the client browser accesses a directory.

Take our modification as an example: when a user clicks a directory, apachewill Go To The index.html under the directory. If no index.htm is available, no index. php is available. If none of them are found, the file list in this directory is displayed by default. Reference: to prevent Apache from displaying the file list

Step 4: Configure PHP

Open the PHP installation directory, that is, D: \ WAMP \ PHP. We can see that the directory contains two such files: php. ini-development and php. ini-production: the first is the configuration file used for development, and the second is the configuration of the production environment. Because we develop on the local machine, select the former. Copy php. ini-development to the same directory and rename it php. ini. This php. ini is the configuration file currently in use. The following steps are to modify the content of this php. ini file. Note that after modifying the php. ini file, you need to restart the Apache service to make the new settings take effect.

1. Specify the directory for storing the PHP extension Library

In Windows, PHP extension libraries are usually stored in the ext directory of PHP in the form of DLL.
Use a text tool to open the php. ini file and find extension_dir = "ext" (approximately 809 rows), that is, the line under On windows. Replace the Semicolon ";" in front of it with the following:

Extension_dir = "D:/WAMP/PHP/ext"

Extension_dir indicates the directory of the PHP extension library to call the corresponding DLL file.

2. Enable the corresponding extension Library

By default, many PHP extension libraries are closed. For example, PHP does not support connection to the Mysql database by default, You need to enable the corresponding extension libraries.
Here we start some common extension libraries.

Search; Windows Extensions (approximately 941 rows), under which is the extension list.

Find the following extension:

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.