WAMP Independent Environment Construction

Source: Internet
Author: User
Tags apache php mysql version php definition

Building the basics of the environment
    1. What is a website?

A Web site is a computer that provides Web Access services.

User: A Web site is a way for a user to access it through a browser (web). (On the browser, you get resources for other computers (Web servers) and display them by entering a URL.) )

Programmer: A website is a computer with a server installed, providing a resource (folder) that can be accessed

2. What is a server?

The server is a hardware (computer), a computer capable of providing services to the outside.

Server: A computer with server software that provides access to external services.

What are the servers?

Web server: Apache,iis,tomcat, etc.

Database server: Mysql,oracle,db2,sqlserver, etc.

File Upload server: FTP, etc.

File Management Server: SVN, etc.

3. What is a URL?

Url:uniformed Resource Locator, unified resource positioning, on the Internet (local area network) there are many computers connected, one or more of them to provide a special service, and then other computers need to get services from this computer. A mechanism is needed to be able to find a certain computer, using a URL, from a single internet.

URL: Is the absolute path on the Internet

such as: http://www.itcast.cn/gz/php/index.php

http: protocol, the Internet must follow the transport protocol

WWW.ITCAST.CN: hostname, the name of the corresponding folder on a computer on the Internet

itcast.cn: Domain name, first-level domain name (. Com,.cn,.china: Domain name server)

www.itcast.cn: Two-level domain name: Add a word to the left of the first-level domain name

Luntan.itcast.cn: Level Two domain name

/gz/php/index.php: Determine the location (directory structure) of the corresponding files on a server

The index.php file under the Php folder in the root directory of the computer Web site under the GZ folder

Uri:uniformed Resource Identifier, Uniform Resource Identifier, used to locate the location (path: relative path) of a file on the server

http://www.itcast.cn/index.php?class=php150422

Protocol:/HTTP

Host: www.itcast.cn

uri:/index.php?class=php150422

4. How do I make Web Access to my Web site?

User point of departure:

A) Open the browser

b) Enter the URL and press ENTER (request)

c) Browser display data

Server angle:

A) Receiving requests (welcome)

b) Resolve the request (ask the customer what they need to buy: buy salt)

c) Response (to User salt: User gives money)

IP: A unique identity that binds to the NIC on each computer, one IP can represent a computer (unique), and the Internet is matched by a TCP/IP protocol for computer matching

Domain name: The domain name can also be understood as the hostname, is a site corresponding to the "folder" (folder alias) name, because the IP address is difficult to remember, the user experience is quite poor. Use the domain name to give the IP address also take the individual name, the user only need to remember the domain name (host name), the browser input URL when also do not need to enter the IP

Dns:domain Name System, domain name systems, dedicated user resolution domain name replaced by corresponding IP address

Hosts file: Local domain name resolution (all requests made by the browser are parsed locally by the Hosts file first)

PORT: The software on the computer (server) used to listen for external requests sent over (doorman)

5. Software Architecture?

Software is divided into two types: c/s structure, b/s structure

C/s:client/server, the client/server, this software structure must ensure that the user's computer is installed on the client (corresponding to the servers), such as QQ, Fei-Qiu

Clients can only initiate requests to the server

B/s:browser/server, browser/server, this structure only requires the user to have a browser.

A browser is a universal client.

6. Development environment?

The development environment refers to the installation of software: The software is divided into two

Integrated environment: Some people will implement a function need to use multiple software to merge (package), become a software, users use, only need to install a software to implement the installation of multiple software: such as Wamp = Apache + mysql + php + windows

Xapp,appserv,phpstudy ===== Windows + Apache + mysql +php

Stand-alone environment: Users install multiple required software autonomously

The difference between an independent environment and an integrated environment

Integration Environment Benefits

    1. Easy to install with integrated environment
    2. Easy and convenient to use (internal configuration already implemented)

Integration Environment Disadvantages

    1. The integration environment is thin-provisioned, so some features cannot be used
    2. Integrated environment is personal production, unsafe
    3. Version limit

Independent Environment Advantages

    1. More features supported, can be configured freely
    2. Security: Install and configure yourself

Independent environmental Disadvantages

    1. Installation trouble, multiple software needs to be installed
    2. Configuration hassle: Multiple software collaboration required

Choose

When developing, basically using an integrated environment (simple)

When deployed (on-line), basically use an isolated environment (security): lamp = Linux + Apache (Stable) + MySQL + php = = = Lnmp = Linux + nginx (high efficiency) + MySQL + PHP

Installing Apache

Apache is the software that provides Web Access services.

    1. Get Apache installation files: http://www.apache.org

1. Double-click Install: Open the Welcome screen

2. Click "Next" to enter the Protocol interface

3. Agree to the agreement, click "Next" to enter the application prompt interface

4. Click "Next" to enter the host Configuration screen.

5. Enter the domain name, host name, mailbox, select All users, click "Next", enter the type selection interface

6. Select the custom installation, click "Next" to enter the path selection screen

Note: The installation path cannot have Chinese and cannot have spaces

7. Modify the installation directory: for D:/server/apache, click "Next" to enter the installation Preparation screen

8. Click "Install"

      1. Click "Finish" to complete the installation

Reason for failure: Port occupied: Apache uses 80 port by default

9. Test the installation success: enter localhost (hostname) in the browser

Hypothesis: Apache is not installed on its own computer

10. View the Apache directory structure

Htdocs Directory: web site root directory

Apache can simply read the contents of the file, and then directly to the browser: Apache can not parse any content inside the file

Browser can only parse HTML and CSS and JS, do not recognize the PHP code

How Apache Works

Apache works in a modular way: When a module is required to work, a module is loaded

Httpd.exe: In Apache's Bin directory, this is Apache service software

The software is run under CMD: Need to go to the console (Cmd:command)

Solution: Configure environment variables and go to the corresponding directory

Httpd.exe is used in conjunction with naming

-M command: See what modules Apache has in total

-T: Test Apache for correct configuration

Profile: Is the soul of Apache's work (Apache's work is dictated by the profile), and Apache works exactly as instructed and configured by the configuration file. /apache/conf/httpd.conf

The modified effect

Note: Configuration file modifications do not change the way Apache works (requires a restart of Apache)

Uninstall the integration environment before installing an isolated environment, uninstall considerations

    1. Save all files in www directory (php file)
    2. Save Bin directory->mysql-"MySQL version folder->data-" own new database corresponding folder; Bin directory->mysql-"MySQL version folder->data there is a ibdata1

PHP Understanding
    1. What is PHP?

PHP is a scripting language that runs on the server side.

Running on server side: Browser does not recognize

Apache itself cannot parse any script (including HTML)

PHP: Early, Personal homepage, personal home page, Perl development

PHP: Late, PHP hypertext Preprosessor, Hyper-text preprocessor, the bottom is in C language development

PHP Definition: A server-side HTML scripting/programming language, is a simple, object-oriented, interpreted, robust, secure, high performance, architecture-independent, portable, dynamic scripting language. is a versatile scripting language that is widely used in open source, especially for Web development and that can embed HTML. Its syntax is close to C,java and Perl, and is easy to learn. The language allows Web developers to quickly write dynamically generated Web pages.

    1. What is the history of PHP?

Rasmus Lerdorf

Development history

1994:1 Personal Perl,personal Homepage

1996:2.0,c Language Bottom-level compilation

1998:zend Company is responsible for PHP specifications, version 3.0, Zendengine can efficiently interpret the PHP language

2000:4.0,session (Session technology) + output buffering, etc.

2004:5.0,zend Engine 2 Generation

2. What is a scripting language?

The scripting language is relative to the compiled language.

Compiled language: Written code can not be executed directly, you need to compile through the compiler, get the compiled result file (the file is completely different from the original code file), and finally execute the compiled results. such as: C,c++,c#,java, etc.

Scripting language: is an interpreted language that does not need to be compiled in advance and compiles directly when it needs to be run. Scripting languages are usually web sites.

The most time-consuming part of the website is: The network, the user is unaware of the time spent in the background scripting language parsing.

Install PHP
    1. Get the PHP installation file: Official website: http://www.php.net

2. Unzip

3. Move the package to D:/server

4. Renaming

Directory structure for 5.PHP installation files

6. Proof: Php.exe can parse PHP code: use Php.exe under cmd

php.exe–f php file path

Apache Load PHP Module

Apache handles PHP as a module inside Apache.

PHP should be loaded in the Apache configuration file.

7. Modify the Apache configuration file to load PHP

LoadModule php5_module PHP provides the path of dynamic linking to Apache

Represents Apache's ability to use PHP modules

8. Modify the Apache configuration file: Tell Apache when to use PHP

The files ending in. php are given to PHP for processing.

AddType application/x-httpd-php. php

9. View the effect of requesting Apache PHP files

PHP configuration file

By default, PHP provides users with two sets of configuration files for filtering, but neither is enabled.

You have to become php.ini to use it.

Select the configuration file for the development environment: to ensure that future configuration file errors can be retrieved again. Duplicate a copy and rename it again

Modify PHP config file: timezone

To make the PHP configuration file effective: If Apache wants to load the PHP config file into Apache itself.

The path where the Phpinidir php.ini is located

Effect

Install MySQL
    1. Get installation files: Official website http://www.mysql.com

2. Double-click Install to go to the installation Welcome page

3. Click "Next" to enter the Protocol interface

4. Agree to the agreement, click "Next" to enter the installation Type selection screen

5. Select Custom Installation: Click "Custom" to enter the Custom installation interface: Installation path

5.1 Select the installation path

5.2 Choosing a data store path

6. After modifying the installation path and data storage path, click "Next" to enter the installation Preparation screen.

7. Click "Install"

8. Click "Next" to continue the installation, click two times, go to complete the installation interface

9. Click "Finish" to complete the installation, open the configuration Preparation interface

10. Click "Next" to enter the instance selection configuration interface

11. Select the detail configuration and click "Next" to enter

12. Select the developer machine and click "Next" to enter the database using the Select interface

13. Select the multi-function database and click "Next" to enter the InnoDB table space setting interface.

14. The default does not need to be modified, click "Next" to enter the concurrent volume selection interface

15. Select manual settings, set the concurrency amount to 15, click "Next" to enter the network settings interface

16. Tick Add firewall exception, click "Next" to enter the character Set selection screen

17. Select Manually select the character set and select the character set as UTF8 and click "Next" to enter the operating system configuration interface.

18. Tick the Add Mysqlbin directory to Windows environment variable, click "Next" to enter the security Configuration interface

Note: Do not check anonymous account

19. Enter the root user password, tick allow remote root user access, click "Next" to go to configure the pending interface

20. Click "Execute" to perform the configuration: to wait until 4 white circle, all are checked to calculate the complete configuration

21. Click "Finish" to complete the installation

22. Understanding the MySQL installation directory structure

Bin directory

Data Directory

23. Verify that MySQL is installed successfully

24. By viewing a service or process

25. Prove that the server is functioning by accessing the server.

Suppose: Now the MySQL server is installed on a different computer.

MySQL is a C/s structure of software, you need to access the server through the client: Mysql.exe

Mysql.exe need to run with cmd

Access mode

Mysql–hlocalhost–p3306–uroot–p (Recommended enter and then input)

PHP operation MySQL

PHP operation MySQL

PHP does not operate MySQL, and does not have this ability. Must be done with third-party extensions.

PHP must impersonate a MySQL client to achieve access.

    1. PHP must load PHP operation for MySQL extension: php.ini

2. Specify the path to the extension: Make sure to find the corresponding extension

3. View Effects

Virtual Host

Host: A corresponding domain name corresponding to a computer, a domain name only one IP, and a computer can only have an IP address. A computer can only do one website.

A Web site is a folder, and a computer can have multiple folders.

Virtual Host: Not a real host, by defining a different name for the site (folder), then other users can access the contents of different folders on a computer by name.

Virtual Host Classification: IP-based virtual host and domain-based virtual host

IP Virtual Host

IP virtual host requires that a computer is using IP to correspond to different folders (websites), in fact, a computer can have multiple IP addresses, need hardware support, as long as the computer to plug in multiple network cards (IP binding on the network card)

Domain Name Virtual host

There is only one IP on a computer, but there are many folders need to do the website (different website), when the user visits, do not allow the direct use of IP access, you must give a name (domain/hostname), on this computer to different folders to bind different host name, so can be different host name to find different sites.

1. Domain-based virtual host Open

2.NameVirtualHost *:80 #开启虚拟主机: Listening from all IP addresses is 80 port

3. Add a virtual Host

<virtualhost *:80>

#里面代表一个虚拟主机

#主机名: Aliases for folders

ServerName www.itcast.cn

#文件夹: Path

DocumentRoot "d:/class/php150422"

</VirtualHost>

4. Restart Apache to identify the corresponding configuration changes

5. Modify the local Hosts file: Increase the resolution of the domain name corresponding IP address

6. Permission control: Requires permission control for the specified folder

<directory folder path: usually documentroot corresponding path >

#权限顺序

Order Deny,allow #deny和allow的顺序可以颠倒: Sequence of Read permissions on behalf of the system

#权限控制

Allow from all #允许全部用户访问

Deny from all #禁止所有用户访问

</Directory>

7. Allow access to file list (directory), when the user does not specify which specific file to access, directly to the user all file list

Options Indexes followsymlinks #FollowSymLinks是表示是否允许软链接

8. System Add Default Access interface

DirectoryIndex to access the home file index.html index.php ... The system to find index.html first, not found on the downward continue to look for

Virtual Host managed separately

Place all the virtual hosts in a file, and then load the corresponding virtual host files in the master profile httpd.conf.

9. Load the virtual host configuration file first: httpd.conf

10. Add the virtual host file to maintain all the virtual hosts in the virtual host file

11. Once the virtual host is enabled: The default localhost will fail: Create a new localhost virtual host

WAMP Independent Environment Construction

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.