Apache configuration for php learning

Source: Internet
Author: User
After completing the php configuration, we will introduce the installation and configuration of apache today. I believe that after this lesson, php learners can install and configure apache on their own.

After completing the php configuration, we will introduce the installation and configuration of apache today. I believe that after this lesson, php learners can install and configure apache on their own.
1. install apache
First download an apache installation package from the Internet. Here we take apache_2.2.6 as an example. This section briefly introduces how to install and configure apache.
1. run apache_2.2.6-win32-x86-no_ssl.msi
Enter Network Domain: you can enter 127.0.0.1 locally.
Server Name: Server Name
Administrator's Email Address: enter your Email Address.
Click next to install the SDK.
2. after installation, open the httpd. conf file in the conf directory under the installation directory, and add the following three lines at the end:
LoadModule php5_module "c: php/php5apahe2_2.dll"
AddType application/x-http-php.php
PHPIniDir "c: \ php"
In this way, php and apache are associated.
3. After apache is installed, you can view the service in "Start> Program> Management Tools> services.
II. apache configuration
1. description of the apache configuration file
Find httpd. conf in the conf folder of the installation directory. this is the main configuration file of apache.
# Annotation
Listen 80 indicates that the listening port is port 80.
DocumentRoot "D:/Program Files/Apache Software Foundation/Apaeh2.2/htdocs" website Program root directory
Default file name of DirectoryIndex index.html website program
2. simple configuration of apache
Change DocumentRoot "D:/Program Files/Apache Software Foundation/Apaeh2.2/htdocs" to DocumentRoot "e:/source ", this means that the root directory of the website program is set to the source folder of the E disk.
Similarly Change

Enable the VM-remove; Include config/extra/http-vhosts.conf before;
Then, locate DirectoryIndex. php index.html. when www.a.com is input, the index. php file will be executed first.
Finally add the VM, open the httpd-vhosts.conf under extra under the config file directory, add

ServerAdmin webmaster@dummy-host2.127.0.0.1
DocumentRoot "e:/source/test"
ServerName www.test.com
ErrorLog "log/dummy-host2.127.0.0.1-error.log"
CustomLog "logs/dummy-host2.127.0.0.1-access.log" common

3. modify the host file
Find the C: \ WINDOWS \ system32 \ drivers \ etc \ hosts file
Add a row 127.0.0.1 www.test.com
In this way, you can simply configure the apache environment. at this time, php learners need to add a test folder under e:/source and add a webpage to it.

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.