Objective:
LAMP:
L:linux
A:apache (httpd)
M:mysql,mariadb
P:php,perl,python
Web Resource type:
Static resources: The original form and response content are consistent;
Dynamic resources: The original form is usually a program file, it needs to be executed on the server side, return the execution result to a client;
Client technology: JavaScript
Server-side technology: php,jsp
Cgi:common Gateway Interface (Universal Gateways Interface)
Allows a client to transfer data from a Web browser to a program that executes on a network server; CGI describes a standard for transferring between client and server programs;
program = instruction + data
Data Model:
Hierarchical model
Mesh model
Relational Model: Table (row + column)
Relational model: Oracle,sybase,infomix,db2,sql SERVER,MYSQL,POSTGRESQL,MARIADB
The instruction is stored in the code file, and the data is stored in the data storage system and the file.
Client--http Protocol--httpd--(CGI protocol)--server (program file)--(MySQL driver)--mysql database
PHP: scripting language, embedded Web application development language embedded in HTML; no compilation required
Can be compiled based on zend into opcode (binary format bytecode, run repeatedly, can omit the compilation environment)
LAMP:
HTTPD: Receives the user's Web request, the static resource responds directly, and the dynamic resource is the PHP script, and the request for such resource will be run by PHP;
PHP: Run PHP program;
MariaDB: Data management system;
How HTTP works with PHP: CGI, FastCGI, modules (compiling PHP into a httpd module)
Deploy lamp based on CentOS 7:
Httpd,php,mariadb-server,php-mysql
[[email protected] ~]# systemctl start httpd.service[[email protected] ~]# systemctl start mariadb.service[[email protected] ~]# ss -tan #3306端口处于监听状态标明mariadb已经成功启动State Recv-Q Send-Q Local Address:Port peer address:port listen 0 50 *:3306 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *: * estab 0 52 172.16.249.130:22 172.16.250.24:59959 time-wait 0 0 172.16.249.130:55636 115.28.122.210:80 TIME-WAIT 0 0 172.16.249.130:44862 124.202.129.6:80 last-ack 1 1 172.16.249.130:39339 210.32.158.231:80 LAST-ACK 1 1 172.16.249.130:43057 112.124.140.210:80 LISTEN 0 128 :::80 :::* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* [[email protected] ~]# mysql # Go to MySQL command line client program Welcome to the mariadb monitor. commands end with ; or \g.Your MariaDB connection id is 2Server version: 5.5.44-mariadb mariadb servercopyright (c) 2000, 2015, oracle, mariadb corporation ab and others. type ' help; ' or ' \h ' for help. Type ' \c ' to clear the current input statement. mariadb [(None)]>
MySQL command line client program supports a variety of SQL statements to manage data;
-U: Indicates the user accessing the database;
-H: Intelligent Light name host address;
-P: Enter password
DDL (data definition Language), DML (Data manipulation language)
Ddl:create,alter,drop,show
Dml:inset,delete,select,update
Authorized to connect the user remotely:
mariadb [(None)]> grant all on testdb.* to [email protected] ' 172.16.%.% ' IDENTIFIED BY ' testpass '; #授权testuser password Testpass, Also in 172.16. Users of the network segment can access the TestDB database query ok, 0 rows affected (0.00 sec) mariadb [( None)]> flush privileges; #刷新权限, let MySQL reread the authorization form Query ok , 0 rows affected (0.00 SEC) [[email protected] ~]# vim /etc/ my.cnf.d/server.cnf [mysqld]skip_name_resolve = on # Adding this option to the MySQL configuration file means crossing name resolution, otherwise denying access to the database because of inconsistent user name and resolved native address when we specify a native address for MySQL [[email protected] ~]# systemctl restart mariadb.service[[email protected] ~]# mysql -utestuser - h172.16.249.130 -penter password: welcome to the mariadb monitor. commands end with ; or \g.your mariadb connection id is 3server version: 5.5.44-mariadb mariadb servercopyright (c) 2000, 2015, oracle, mariadb corporation ab and others. type ' help; ' or ' \h ' for help. Type ' \c ' to clear the current input statement. mariadb [(None)]> #这样我们就能使用我们设置的用户名访问数据库了MariaDB [(none)]> select user (); +-------------------------+| user () |+------------------------ -+| [email protected] |+-------------------------+1 row in set (0.01 Sec
PHP test code to connect to MySQL:
[Email protected] ~]# vim/var/www/html/index.php<?php $conn = mysql_connect (' 172.16.249.130 ', ' testuser ', ' Testpass '); if ($conn) echo "OK"; else echo "failed";? >
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/AC/wKiom1aXosHjl3mVAAAjwlrJeVU189.png "title=" 1.PNG " alt= "Wkiom1axoshjl3mvaaajwlrjevu189.png"/>
Deploy PHP Blog program WordPress:
[[email protected] html]# ls #下载wordpress安装包解压到根文档目录下fstab. html index.php WordPress wordpress-4.3.1-zh_cn.zip
LAMP (not finished)