Linux--lamp Introduction, Construction, linux+apache+mysql/mariadb+php

Source: Internet
Author: User
Tags php server

1.lamp Introduction

1. The so-called lamp, in fact, is a group of Linux+apache+mysql/mariadb+php/python Dynamic Web site or server open source software, in addition to Linux and other components themselves are separate programs, but because often put together to use, With a growing degree of compatibility, together they form a powerful Web application platform. Lamp refers to the first letter of the Linux (operating system), Apache (HTTP server), MySQL (also referred to as MARIADB, database software), and PHP (sometimes referred to as Perl or Python), which is commonly used to build a Web application platform.
2.web Server Workflow Before we say the lamp architecture platform, let's first understand what is CGI, what is fastcgi, what is ... Web server resources are divided into two types, static and dynamic resources

    • Static resources refer to static content, and the client obtains resources from the server in the same form as the original file. It can be simply understood as a resource that is stored directly in the file system.
    • Dynamic resources are usually program files that need to be returned to the client after the server executes

So how does the Web server execute the program and return the results to the client? Here's a diagram to illustrate how the Web server is located


Phase 1 shows that the HTTPD server (that is, Apache) and the PHP server communicate through the FASTCGI protocol, and PHP runs as a standalone service process
Phase 2 shows that the PHP program communicates with the MySQL database through the MySQL protocol, and PHP is not connected to MySQL, but a program written in PHP can interact with MySQL. Similarly Perl and Python-written programs can also interact with MySQL databases

2.1 CGI and fastcgi

FASTCGL is mentioned in Phase 1, so let's look at the CGI and fastcgi.

Cgi

CGI(Common Gateway Interface,通用网关接口),CGI是外部应用程序(CGI程序)与WEB服务器之间的接口标准,是在CGI程序与Web服务器之间传递信息的过程,CGI规范允许Web服务器执行外部程序,并将它们的输出发送给Web浏览器,CGI将web的一组简单的静态超媒体文档变成一个完整的新的交互式媒体。

FastCGI

FastCGI(Fast Common Gateway Interface)是CGI的改良版,CGI是通过启用一个解释器进程来处理每个请求,耗时且耗资源,而FastCGI则是通过master-worker形式来处理每个请求,即启动一个master主进程,然后根据配置启动几个worker进程,当请求进来时,master会从worker进程中选择一个去处理请求,这样就避免了重复的生成和杀死进程带来的频繁Cpu上下文切换而导致耗时。

Linux--lamp Introduction, Construction, linux+apache+mysql/mariadb+php

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.