PHP learning and teaching (02. Apache + PHP environment configuration-Part 1)

Source: Internet
Author: User

TIPS: if you have not downloaded the software, please go to the first tutorial!

Required: If you have installed an IIS server, go to "start"> program ">" Administrative Tools ">" Internet Information Service (IIS) manager ">" website "to stop all websites. Otherwise, Apache cannot be started.

Part 1: Install the Apache server

Find the downloaded apache_2.2.3-win32-x86-no_ssl.msi file and double-click to install it.

• Apache installation interface •

(I tried to steal some existing images from the Internet)

Step 1:You don't need to know, but click "Next.
Step 2:Click "I accept the terms... (Agree to the Agreement) and then click "Next.
Step 3:Then you will see the description of the Apache server, and click "Next" again.
Step 4:Finally, we can see an interface for entering something, such:

The above three input baskets are domain names, server names, and administrator mailboxes. Because it is locally installed, you can enter what you like. If it is a configuration server with live ammunition, pay more attention to it. Enter the "Network Domain" Domain Name Information in the first basket. Enter the Domain name of your server here. If you have applied for a Domain name, enter the Domain name you applied, (Note that the domain name is entered here, only the second half of the complete domain name you applied for, excluding "www ". If you are applying for a second-level domain name, it is the part after the first ".".) If you do not have a second-level domain name, just fill in the local IP address. The next basket is the server name. Fill in the complete domain name or IP address. The next basket is the administrator's Email address. These three items must be entered after installation, but you can modify them at any time after installation, so you do not have to worry about problems if you fill in the errors. The final option indicates whether to use port 80 or port 8080. Generally, you do not need to change it (we use the default port 80 ). Okay, too much nonsense, ignore it, and click "Next" after filling out.

Step 5:There are two options: Typical (Typical installation) and Custom (Custom installation). To save time, select Typical and click "Next.

Step 6:You will see a "Change ..." You can use it to change the Apache installation directory. The default installation directory is C: \ Program Files \ Apache Group, you can change the directory installation, which has little impact. For convenience, we use the default directory here. Click "Next.

Step 7:To Install the SDK, click "Install. • Apache installation process •

Click "Finish" to complete the installation.
OK. Now click Apache HTTP Server 2.2.3> Control Apache Server> Start in your Start Menu.
This step is to start the server.

God bless, now we are going to test whether the installation is successful. Open the browser and enter http: // localhost or http: // 127.0.0.1 in the address. If you can see the following interface, the installation is successful. Otherwise ...... Come back. Good luck.

If the installation is successful, proceed. Now we need to simply configure the Apache server and locate the PHP file. Generally, the directory in the PHP folder is C: \ Program Files \ Apache Group \ Apache2 \ htdocs. Let's test it. Write an HTML file and enter the following code: Program code
<Head>
<Title> Hello World </title>
<Body>
Hello World
</Body>
</Head>
</Html>

Save the file as “hello.htm and copy it to the C: \ Program Files \ Apache Group \ Apache2 \ htdocs directory. Open the browser and enter http: // localhost/hello.htm to view the output. In other words, the htdocs folder is used to store website files. Of course, we can also modify it. In order to facilitate the management of website files, you can modify it with me.

Suppose we want to put all the website files under the D: \ PHProot directory, first create the PHProot folder on the D drive, and then open C in Notepad mode: httpd in the \ Program Files \ Apache Group \ Apache2 \ conf directory. conf file, find:
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
Replace the upstream with the downstream:
DocumentRoot "D:/PHProot"

Note: here we use the Diagonal Bar "/" instead of "\" to prevent confusion. Otherwise, an error may occur.

Write another HTML file with the following code: program code
<Head>
<Title> Oh Yeah </title>
<Body>
Oh Yeah
</Body>
</Head>
</Html>

Save the file as “yeah.htm and copy it to the D: \ PHProot directory. Open the browser and enter http: // localhost/yeah.htm to view the output. If "Oh Yeah" is displayed on the webpage, the configuration is successful. Good luck.

Finally, we have completed the installation of Apache. In Apache + PHP environment configuration-Part 1, I will introduce the installation and configuration methods of PHP in detail. I hope you will find some gains in this tutorial. Don't forget to follow the latest tutorial on www.hetty.cn.

-- Hetty)

Click to download the world document for this tutorial.

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.