Centos Build Lamp environment

Source: Internet
Author: User

1. Installing Apache

Yum Install httpd

Related commands:

Systemctl Start Httpd.service #启动apache

Systemctl Stop Httpd.service #停止apache

Systemctl Restart Httpd.service #重启apache

Systemctl Enable Httpd.service #设置apache开机启动

2. Install PHP

Yum Install PHP Php-devel

3. Install MySQL

Download repo source for MySQL

$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Installing the MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM Package

$ sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm

After installing this package, you will get two MySQL yum repo Source:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo.

Install MySQL

$ sudo yum install Mysql-server

4. Install the PHP and MySQL affiliate modules

Yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

Restart MySQL service after successful installation

# Service Mysqld Restart

The initial installation of MySQL is a root account without a password

Set the root user password

Method 1:

# Mysql-uroot

mysql> set password for ' root ' @ ' localhost ' = password (' mypasswd ');

Mysql> exit

Method 2: Use Mysqladmin

mysqladmin-u root Password "NewPassword"

If Root has already set a password, use the following method

mysqladmin-u root password Oldpass "NewPassword"

Create a new user

Grant all privileges the user name created by * to ("%" identified by "password";

Flush privileges; * Refresh the contents of just now *

Format: Grant permission on the database name. Table name to user @ Login host identified by "User password";

such as: Grant all privileges on * * to [email protected] "localhost" identified by "Bodatech"; (Log on locally)

User1 users can only log on locally and operate all databases

Grant all privileges in test.* to [email protected] '% ' identified by ' Boda '; (telnet)

User2 users can log on remotely, and can only manipulate all tables under the test database

To update the permissions of an existing user, simply modify the above command-related parameters and run

After the @ is the client IP address (or hostname) that accesses MySQL represents any client.

Database operation, see the link (thank you for sharing the old a):

Http://www.cnblogs.com/xdpxyxy/archive/2012/11/16/2773662.html

5.Apache Configuration

Find/etc/httpd/conf/httpd.conf

Add Listen 80 Listening port

DocumentRoot "/var/www/html" Web site path

Modify Directory

<directory "/var/www/html" > # #这里的路径和上面修改一致

Options includes execcgi followsymlinks

AllowOverride All

Require all granted

</Directory>

Multi-site configuration: http://www.cnblogs.com/makeup/p/5433837.html

6. Summary of issues:

1, the Linux PHP code does not do not parse does not run the display PHP code

Solution:

Open/etc/httpd/conf/httpd.conf

Find AddType application/x-gzip. gz. tgz

Add AddType application/x-httpd-php. php on the next line

Note AddType application/x-httpd-php. php don't spell it wrong.

2. The database cannot be connected remotely

Modify the My.conf file

Find bind-address = 127.0.0.1 change to bind-address = 0.0.0.0

3. PHP Gets the time default UTC

Change to GMT

Find Php.ini/etc/php.ini, if unable to find executable phpinfo () view

Modify Date.timezone = "PRC"

4. Modify Apache Path case sensitivity

Find/etc/httpd/conf/http.conf

Add a little bit of content:

LoadModule speling_module/usr/lib64/httpd/modules/mod_speling.so Loading Module

CheckSpelling on open Module

Centos Build Lamp environment

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.