Tutorial on building the win7 php environment: detailed steps for building the php environment in win7

Source: Internet
Author: User

Tutorial on building the win7 php environment: detailed steps for building the php environment in win7

Today, the green tea editor will show you how to build the win7 php environment. If you are new to php and do not know how to build the php environment in win7, this article will help you, the steps are quite detailed ~

Note:

1. Download from apache in msi format, click next, OK, and modify httpd. conf for configuration;

2. the configured LoadModule php5_module path must be correctly set. Note that the double quotation marks are English characters;

3. Modify the php configuration by reference. Generally, there is no major problem;

4. If apache cannot be started after configuration is complete, the following error occurs: the requested operation has failed;

5. Error Correction Method: win + r --> cmd --> enter the bin folder in the apache installation directory and enter httpd.exe-w-n "Apache2.2"-k start to find the cause of the error;

6. Possible error causes are classified into three types: 1.80 port occupation; 2. Software conflict; 3. httpd. conf configuration error.

Start of the official step:

1. Install software

1. apache (Apache version: httpd-2.2.15-win32-x86-openssl-0.9.8m-r2, openssl indicates with openssl module, using openssl can configure SSL Secure link for Apache );

2, php (PHP version: php-Win32-VC6-x86, VC9 is specifically customized for IIS, VC6 is provided for other WEB service software, such as Apache ).

II. Environment Configuration

1. Configure the website root directory

After apache is installed successfully, enter 127.0.0.1 or locahost in the browser and a message is displayed for It works! The prompt page is under the apache installation directory (htdocs \ index.html). It indicates that htdocs is the default root directory of the website and conf \ httpd is found under the apache installation directory. in the conf configuration file, open the default path to find DocumentRoot, and set the default path (that is, the path of the htdocs file) as the website and directory.

2. Load the PHP module and set the PHP configuration file path

Decompress the downloaded php file and place it in a fixed directory. Find the php. ini-production file and rename it php. ini as the php configuration file.

Open the conf \ httpd. conf file in the apache installation directory, find the last # LoadModule statement, and add the following two lines below it.

LoadModule php5_module "F:/wamp/php5/php5apache2_2.dll"

PHPIniDir "F:/wamp/php5"

# The above is my own path. Write your own path here, find AddType application/x-gzip. gz. tgz, and add the following two lines below it.

AddType application/x-httpd-php. php

AddType application/x-httpd-php. html

In addition, you need to find the IfModule dir_module and change DirectoryIndex index.html to DirectoryIndex index. php index.html, and finally test whether php is configured successfully. Create an index in the root directory of the website. php file, write several lines of php statements, such:

Note: The installed apache version must be the same as the version number in php5apache2_2.dll. Otherwise, an error will occur when loading the php module, prompting Cannot load php5apache2_4.dll into server.

3. Configure Virtual Hosts

Open the conf \ httpd. conf configuration file, find Include conf/extra/httpd-vhosts.conf, remove the # sign before it, and open the conf/extra/httpd-vhosts.conf file for configuration.

Domain name-based Virtual Host Configuration

DocumentRoot "F:/tbcdn" (specify the website root directory)

ServerName static.tianxia.taobao.com (specified access address)

DocumentRoot "F:/xxx" Custom

ServerName xxx.com custom

Note: NameVirtualHost *: The 80 statement remains unchanged.

IP address-based VM

DocumentRoot "F:/project" Custom

ServerName yjh.com custom

DocumentRoot "F:/xxx" Custom

ServerName xxx.com custom

Note: Change the NameVirtualHost *: 80 statement

NameVirtualHost 127.0.0.1: 80

NameVirtualHost 127.0.0.2: 80

Finally, bind the IP address to the domain name in the hosts file, and then build the php environment in win7 ~

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