CentOS 6.5 Build LAMP environment, centoslamp_php tutorial

Source: Internet
Author: User

CentOS 6.5 Build LAMP environment, Centoslamp


Directory

First step: Install and configure the Apache server

Step two: Set up, bind the site directory file

Step three: Install MySQL database

Fourth step: Install the PHP environment

Summarize

>>begin:

First step: Install and configure the Apache server

Yum Update #更新 Yum
Yum install httpd # using Yum installation httpd (httpd is Apache server) Click-To Know Yum

Install the current version of the Apache configuration environment, and then configure the httpd.conf (location in/etc/httpd/conf/httpd.conf) file. You can also use the default configuration file directly.

KeepAlive OFF
......

Startservers 2
Minspareservers 6
Maxspareservers 12
MaxClients 80
Maxrequestsperchild 3000

The configuration is not to remove the inside settings, but the corresponding parameter modification.

Step two: Set up, bind the site directory file

Manual installation lamp is different from the use of a key package directly with the command to add a domain name establishment site, which all have to use manual operation, such as we need to add a domain name to establish a site.

Vim/etc/httpd/conf.d/vhost.conf #vim is the editing tool under Unix/linux; Meaning of this command: in /etc/httpd/conf.d/vhost.conf text configuration file

Build the vhost.conf file in the above directory and configure the site

Namevirtualhost *:80


ServerAdmin admin@laozuo.org
ServerName laozuo.org
Serveralias www.laozuo.org
DocumentRoot /srv/www/laozuo.org/public_html/
errorlog /srv/www/laozuo.org/logs/error.log
Customlog /srv/www/laozuo.org/logs/access.log combined


ServerAdmin admin@idcxen.com
Servernameidcxen.com
Serveralias www.idcxen.com
documentroot/srv/www/idcxen.com/public_html/
Errorlog/srv/www/idcxen.com/logs/error.log
Customlog/srv/www/idcxen.com/logs/access.log combined

We can see in the above file is the addition of 2 sites, if it is to add multiple sites similar to the replication modification of the corresponding directory. Similarly, we need to create a directory path that does not have the corresponding directory.

Mkdir-p/srv/www/laozuo.org/public_html
Mkdir/srv/www/laozuo.org/logs

Mkdir-p/srv/www/idcxen.com/public_html
Mkdir/srv/www/idcxen.com/logs

  The corresponding directory path such as SRV is what I created, if there is a need for other paths we create ourselves according to our own needs.

Start httpd and set boot up.

/ETC/INIT.D/HTTPD start
/sbin/chkconfig--levels 235 httpd on
/ETC/INIT.D/HTTPD Reload

  

Step three: Install MySQL database

A-Install and start

Yum Install Mysql-server #安装MYSQL服务

/sbin/chkconfig--levels 235 mysqld on # Set boot up

/etc/init.d/mysqld start # starts MySQL

B-Set Database user

Mysql_secure_installation #安装设置ROOT权限, follow the prompts to set the root password

During this installation, you can remove the default other users and other default data by selecting.

Mysql-u Root-p # Login to the root database user

Fourth step: Install the PHP environment

Install the PHP environment, and then configure the/etc/php.ini file.

error_reporting = e_compile_error| e_recoverable_error| e_error| E_core_error
Display_errors = Off
Log_errors = On
Error_log =/var/log/php/error.log
Max_execution_time = 30
Memory_limit = 128M
Register_globals = Off
Max_input_time = 30

  Use VI to find the above parameters, and then corresponding to modify parameters, save exit.

 To create a log file, if we need to support MySQL in PHP, you need to enter the following command to install the Php5-mysql package.

mkdir/var/log/php
Chown apache/var/log/php

  

Install and set up startup.

Yum Install Php-mysql
/ETC/INIT.D/HTTPD restart

Summarize:

In this way, our domain name site binding, MySQL database has been added, such as we need to install the laozuo.org domain name WordPress program or other programs, only need to upload the program in the/srv/www/laozuo.org/public_html/directory , and then use the set of database users to install it.

In addition, you will use VIM to edit the file (Vim Learning Reference), will use the basic unix/linux command (Linux Command Learning Reference);

This article main content reference: Old Left Blog

http://www.bkjia.com/PHPjc/1140574.html www.bkjia.com true http://www.bkjia.com/PHPjc/1140574.html techarticle CentOS 6.5 Build LAMP environment, Centoslamp directory first step: Install and configure Apache server Step two: Set up, bind site Directory files step three: Install MySQL database fourth step: Ann ...

  • 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.