WAMP environment installation and testing, WAMP environment installation and testing

Source: Internet
Author: User

WAMP environment installation and testing, WAMP environment installation and testing
First, let's add: the development history of web Services, Peer Network Service Model

There are no dedicated servers and no dedicated clients! Cannot provide reliable services!

C/S Mode

Client/server. Different clients and servers are installed respectively!

B/S Mode

Browser/Server, evolved from the C/S model! (Equivalent to unified all clients into browsers)

 

The core mode of web development is: B/S!

Because the browser does not need to be set up! Therefore, we only need to build a web server!

Integration Environment: such as wamp xamp PHPstudy

(Here, apache, php, and mysql are all customized to install CUSTOM, red font considerations)

1. Install and manage Apache (2.2.22 is used in my current version)

 

Whether the ssl module is included depends on whether an https server needs to be configured!

Https is an ssi-encrypted http protocol! Safer!

 

What is IPAddress? What is a domain name?

The domain name is actually a name for the IP address!

The relationship between IP addresses and domain names can be one-to-many!

First, resolve the domain name to the corresponding IP address! This process is completed by the DNS server!

 

There is actually a dns server on this machine.

 

 

Loop Test!

When performing dns resolution, first find the hosts file on the local machine. If not, find the relevant dns server on the network!

Select custom installation: (select Custom installation)

 

Set the installation directory: note that the directory contains the best Chinese characters!

 

Click install.

 

How to test?

 

You can also test with the address: Your local IP Address

Where does It works come from:

Under the default document root directory!

 

Manage apache

There are two common management methods:

1. apache provides a management image!

 

Note: It is not a server management software, but a management image!

 

2. windows Service Management

 

 

In fact, you can enable or disable the apache server in cmd.

Syntax:

Httpd.exe-k stop the server

Httpd.exe-k start enable Server

Incorrect path:

 

 

It is troublesome to enter the directory path every time. You can set the environment variable first:

Right-click computer and select properties:

 

Restart cmd: You don't need to enter the folder operation any more, but I didn't set it. I'm used to cd operations, so I won't be able to do it here.

Ii. installation and configuration of php

Php installation is relatively simple. Just decompress and copy it! I use php5.4 here.

However, php is only an independent module and can be run independently! It has nothing to do with apache!

 

Version:

 

 

First, you must understand the relationship between apache and php!

Apache is responsible for receiving browser requests. If the user requests an html file and responds directly, if the user requests a php resource, the file will be handed over to the php engine for processing!

Typical: apache calls php! That is to say, you should first install php into a functional module of apache!

 

What is an apache module?

Apache itself is not very powerful, but it can load various extension functions, that is, various modules!

Apache itself is a software composed of various modules!

 

Step 1: load the php Module

Go to the httpd. conf file in the conf folder of apache.

Many modules use configuration commands:

LoadModule is loaded into apache!

Each module is actually a compiled library file!

 

Modules loaded by apache:

 

130 rows

 

Note: # Is a comment, remove # is to enable it. Pay attention to your directory path here.

At this point:

Test files can be tested only when they are stored in the htdocs folder in apache.

Step 2: Submit the php file to the php engine for processing in apache

That is, assigning tasks to php!

 

Step 3: Determine the php configuration file

The name of the php configuration file is php. ini.

 

This configuration file is relatively independent. That is to say, it can appear anywhere in the system, but we usually place it in the php Directory for convenient management!

So, first, tell apache where to find this configuration file!

Go to httpd. conf In the conf folder of apache to configure

 

Step 4 Add php. ini under the corresponding directory

 

 

The production mode means that the system is open to the outside world:

 

Copy the php. ini-development file and change the copy to the php. ini file.

Step 5: Modify the time zone

 

Search for timezone in php. ini:

 

Every time you modify the php. ini configuration file, you must restart apache to make it take effect.

Because php is also part of apache!

 

Iii. installation and configuration of mysql

The most important core of business logic: Data!

Mysql is an independent software (mysql 5.5 is used here, so the default storage engine is Myisam, mysql5.6, and the default storage engine is Innodb for Versions later than 5.6)

 

Mysql installation comes with a configuration phase!

Install

Select custom installation:

 

Select the installation directory:

The first and last paths must be selected.

 

Start installation:

 

Configuration

Select detailed Configuration:

 

Select development:

 

Select a multi-function Server:

 

You can choose low concurrency or custom:

 

Select the custom one, select the UTF-8

 

Operate mysql

Mysql is based on the C/S management mode!

To operate mysql, you must have a client!

By default, the system comes with one:

 

Generally, the host and port number can be omitted.

However, in a real project, you cannot use the command line in cmd to operate mysql. Instead, you can use php to operate mysql!

Therefore, the role of php is: a functional module of apache and a mysql client!

4. Use php to operate mysql

The procedure for the client to operate mysql:

Step 1: configure the mysql client with php

Like apche, php is actually composed of many operation modules! However, in php, these modules are called extensions of php)

In apache, The LoadModule command is used to load the module!

In php, the php configuration command extension is used to load php extensions!

Find php. ini, search extension, and remove the; number to enable the Service.

 

Change the path to your folder path

 

Step 2: Tell php under which directory to find the extension file

 

Search extension_dir in the configuration file

 

Test mysql

Enter the database: mysql-h127.0.0.1-P3306-root-p (your password)

Step 3: Complete Test 1, establish connection and authentication

Note: Unlike using command lines in cmd to operate mysql, php uses a series of built-in functions to operate mysql!

 

Ii. Sending operation commands

3. Return processing results

 

Show all your database names cyclically

4. Disconnect

 

So far, amp has been set up !!

 

V. VM Configuration

There are two types of apache Virtual Hosts: ip-based virtual hosts and domain-based virtual hosts!

What we need to do is a domain name-based Virtual Host!

Assign different domain names to each host! The browser will view different directory resources based on different regions of the accessed domain name!

 

First, modify the apache configuration file!

Step 1: First load the configuration file of the VM

Search for vhost in httpd. conf

 

What is the minimum basic information contained in a VM?

Domain Name (server name)

ServerName

Directory (host directory)

DocumentRoot

 

Configure the hosts file on the local machine

Note that the virtual host of localhost should also be retained. Each time a new project is added, a new virtual host configuration is added, separated

The wamp environment is ready at this time, so you can write code happily.

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.