CentOS6.5 build a LAMP environment, centoslamp_PHP tutorial

Source: Internet
Author: User
CentOS6.5 build the LAMP environment, centoslamp. CentOS6.5 build the LAMP environment. The first step of the centoslamp directory is to install and configure the Apache server. Step 2: Set and bind the site directory file. Step 3: install the MYSQL database. Step 4: set up the LAMP environment in CentOS 6.5, centoslamp

Directory

Step 1: install and configure the Apache server

Step 2: Set and bind the site directory file

Step 3: install the MYSQL database

Step 4: install the PHP environment

Summary

> Begin:

Step 1: install and configure the Apache server

Yum update # update yum
Yum install httpd # use yum to install httpd (httpd is the Apache Server). click-> Learn more about yum

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

KeepAlive Off
......

StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000

You do not need to delete all settings in the configuration, but modify the corresponding parameters.

Step 2: Set and bind the site directory file

Installing LAMP manually is different from using a one-click package to directly add a domain name to create a site. all of these operations must be performed manually. for example, we need to add a domain name to create a site.

Vim/etc/httpd/conf. d/vhost. conf # vim is an editing tool in Unix/Linux. d/create a vhost in the directory. conf text configuration file

Create the vhost. conf file in the preceding 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

In the above file, we can see that two sites are added. if multiple sites are added, copy and modify the corresponding directory. Similarly, we need to create directories without directories.

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, for example, srv, is created by me. if you need other directories, you can create them as needed.

Start httpd and set startup.

/etc/init.d/httpd start
/sbin/chkconfig --levels 235 httpd on
/etc/init.d/httpd reload

  

Step 3: install the MYSQL database

A-install and start

Yum install mysql-server # install MYSQL service

/Sbin/chkconfig -- levels 235 mysqld on # set startup

/Etc/init. d/mysqld start # start MYSQL

B-set Database users

Mysql_secure_installation # Install and set the ROOT permission. set the ROOT password as prompted.

During the installation process, you can select to remove other default users and other default data.

Mysql-u root-p # log on to the ROOT database user

Step 4: install the PHP environment

Yum install php-pear # use yum to install the php environment

Install the PHP environment and 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 search for the preceding parameters, modify the parameters accordingly, and save and exit.

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

yum install php-mysql
/etc/init.d/httpd restart

Summary:

In this way, our domain name site binding and MYSQL database have been added. for example, to install the WORDPRESS program or other programs under the domain name laozuo.org, you only need.

In addition, you must use vim to edit files (vim learning reference) and basic Unix/Linux commands (Linux command learning reference );

For the content of this article, refer to the old Left blog

Http://www.bkjia.com/PHPjc/1140574.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1140574.htmlTechArticleCentOS 6.5 build LAMP environment, centoslamp directory Step 1: install and configure Apache server Step 2: Set, bind site directory file Step 3: install MYSQL database Step 4:...

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.