Creation of the Linux-lamp platform (i)

Source: Internet
Author: User
Tags install php php and mysql

What is a lamp platform?

LAMP is the acronym for a set of free software names that are typically used together to run dynamic Web sites or servers : Linux Linux operating systems

Apache Web Server

MYSQL,MARIADB Database System

PHP scripting language

This is lamp.


What do you need to build a lamp platform for?

First, on the Linux operating system,

1> prepare Apache Web server HTTP server;

# Yum Install httpd (running on port 80)

Enable HTTP service;

# Service HTTP Start (modify port requires re-enable service)

Under test, HTTP can run normally;

In/var/www/html/Edit Main Page index.html 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M01/45/CE/ Wkiol1prb0edo3cjaabyqrfxz6a660.png "title=" 1.PNG "alt=" wkiol1prb0edo3cjaabyqrfxz6a660.png "/> Then open the Service site in the browser, as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/CE/wKioL1PrcOLBYGDgAAAfvhAZvtQ074.png "title=" 2.PNG " alt= "Wkiol1prcolbygdgaaafvhazvtq074.png"/> proves httpd service started successfully

2> Prepare PHP (here PHP is as a module of Linux in the kernel);

# Yum Install PHP

After installing PHP, we will test whether PHP will work properly;

In/var/www/html/edit the file php.php content as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/CD/wKiom1Prc83wf76eAAAMkfXIxtQ886.png "title=" 5.PNG " alt= "Wkiom1prc83wf76eaaamkfxixtq886.png"/>

In the figure phpinfo () is the calling function to display the PHP information, the ability to invoke the success of our PHP will work as follows:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/CE/wKioL1PrdKugMDURAABNMMZwwPo112.png "title=" 4.PNG " alt= "Wkiol1prdkugmduraabnmmzwwpo112.png"/>

For example, successful invocation of the function succeeds, displays PHP information, has version information, and so on.


3> PHP is also installed, the following changes to prepare MySQL,

# yum Install mysqld

Then execute the mysql command

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/CD/wKiom1PreFyRv1DTAABH-pZjbE8023.png "title=" 6.PNG " alt= "Wkiom1prefyrv1dtaabh-pzjbe8023.png"/> So the installation was successful,


Speaking of MySQL, let's talk about some of the commands that are commonly used in MySQL:

Use of MySQL client:

-U USERNAME: Default is Root

-H HOST: default to localhost

-P [PASSWORD]: Enter password

The MySQL user account format is as follows:

[Email protected]

USERNAME: User Name

Host: This user is allowed to log in to the MYSQLD service only through the host specified here;

For example: [email protected], [email protected] ' 127.0.0.1 ', [email protected] ' HOSTNAME '

Check which storage engine is supported:show ENGINES;

View property information for a table:Show Table Statu    

to view supported character sets: SHOW CHARACTER SET;

View collation:show COLLATION;

View server variables:Show {global| SESSION} Variales [like '];

View service status variables;Show {global| SESSION} STATUS [like '];


If you want PHP to communicate with MySQL, you also need to install a php-mysql, which is a connection between PHP and MySQL driver, on the local they are based on socket communication.


Basic Lamp platform Required services we have a good frame, let me realize the next, I take WordPress as an example,

First we are going to download wordpress This installation package,

I've already downloaded it, you go explore it yourself,

And then I'm going to unzip this wordpress bag

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/CD/wKiom1PreeGjXMJvAAAWHfnKKMA843.png "title=" 7.PNG " alt= "Wkiom1preegjxmjvaaawhfnkkma843.png"/> such as, wordpre version as above, I downloaded it to/var/www/html/wordpress this directory

Then CD wordpress, view the files inside

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/CF/wKioL1Pre1mwUa4UAAAwTGE2F48359.png "title=" 8.PNG " alt= "Wkiol1pre1mwua4uaaawtge2f48359.png"/> by can see, wp-config-sample.php this thing to give you a sample of the configuration file, so we just have to put it CP a bit on the line, and named wp-config.php

# Vim wp-config.php

Define (' db_name ', ' LIB ') specifies the database name to be created

Define (' Db_user ', ' sunbin '); Specified login user (do not use root user in actual work)

Define (' Db_password ', '); Specify the password to use

Define (' Db_host ', ' 127.0.0.1 '); Designated as native (mine is this address)

Here's a look at the process of using MySQL to create a database

Use the command MySQL to enter the MySQL client;

# MySQL

Then use the CREATE DATABASE LIB

Mysql> CREATE database lib//creating LIB Databases

See what data has been created and whether it was created successfully

Mysql> SHOW DATABASES;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/45/CD/wKiom1PrfWKRSu0hAAAYTCWGXR4796.png "title=" 9.PNG " alt= "Wkiom1prfwkrsu0haaaytcwgxr4796.png"/>

As shown, I created Lib This library has succeeded,

Then to initialize the database is to restart the service

# Service Mysqld Restart

# Service httpd Restart

Then to test whether my WordPress configuration succeeded,

Enter in the browser: 192.168.0.1/wordpress If you can show the installation page of the personal blog to prove that our installation is successful, I have installed here, I will give you a post-installation of the personal blog page

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/CF/wKioL1Prf8jhz4a9AAgyPKrMuoc122.png "title=" 10.PNG "alt=" Wkiol1prf8jhz4a9aagypkrmuoc122.png "/> Above is the process of configuring lamp, and the implementation of a simple case WordPress process.








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.