Construction of dynamic website wishing wall under lamp environment

Source: Internet
Author: User
Tags mysql host

Prepare for the environment before building, using the Linux distribution CentOS 7

1. Install and start Apache+mysql and place the file in the apache root directory/val/www/html

Installation and start-up method reference: http://www.cnblogs.com/dagege/p/5949620.html

2. First we first set up a user ' Dagege ' in the database, create a database ' Xyq ', give the user ' Dagege ' all permissions to the database ' XYQ '!

[Email protected] ~]# mysql-u root-p   #进入数据库Enter password:welcome to the MySQL monitor.  Commands End With; or \g.your MySQL connection ID is 4Server version:5.6.34 mysql Community Server (GPL) Copyright (c), Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help.    Type ' \c ' to clear the current input statement.mysql> create user ' dagege ' @ ' 127.0.0.1 ' identified by ' Dagege ';    #创建用户和密码, and bind Ipquery OK, 0 rows Affected (0.00 sec) mysql> CREATE database Xyq;    #创建数据库Query OK, 1 row Affected (0.00 sec) Mysql> Grant all privileges in xyq.* to ' dagege ' @ ' 127.0.0.1 '; #给来自IP: 127.0.0.1 ' dagege ' user xyq all permissions to the database query OK, 0 rows Affected (0.00 sec)

3. Enter the database ' Xyq ' and import the SQL file (the link is extracted)

mysql> use XYQ; #进入数据库Database changed
mysql> [Copy all the contents of two SQL files paste it over] #导入sql文件

4. Install Php-mysql (configure local Yum source)

[[email protected] xyq]# yum install php-mysql loaded plugin: fastestmirror, langpacksloading mirror speeds from cached Hostfile * C6-media: Resolving dependencies There is unfinished transactions remaining. You might consider running yum-complete-transaction, or "Yum-complete-transaction--cleanup-only" and "Yum redo LA St ", first to finish them. If those don ' t work for you ' ll has to try removing/installing packages by hand (maybe Package-cleanup can help) .--> is checking transactions ---> Package php-mysql.x86_64.0.5.4.16-36.el7_1 will be installed--processing dependencies php-pdo (x86-64) = 5.4.16-36.el7_1, which is the package php-mysql-5.4.16-36.el7_1.x86_64 required--Checking transaction---> Package php-pdo.x86_64.0.5.4.16-36.el7_1 will be installed-- Resolve dependencies to complete dependency resolution =================================================================================================                             ========================================================== Package Architecture Version Source Size ========================================================================================================================== ================================= Installing: Php-mysql x86_64 5.4.16-36.el7_                           1 C6-media K for dependency installation: Php-pdo x86_64 5.4.16-36.el7_1 C6-media-K transaction summary ========= ===============================================================================================================  =================================== Install 1 packages (+1 dependent packages) Total Downloads: 196 k installation Size: 424 kIs This OK [y/d/n]: ydownloading packages:error  Downloading packages:php-pdo-5.4.16-36.el7_1.x86_64: [Errno] No more mirrors to try. PHP-MYSQL-5.4.16-36.EL7_1.X86_64: [Errno] No more mirrors to try.

5. Modify the file connect.php then save!

<?php$host= "127.0.0.1";    Here writes the MySQL host's ip$db_user= "Dagege";    Here write the username we just created $db_pass= "Dagege";     Here write the password $db_name= "Xyq"; Here write the database we created $timezone = "Asia/shanghai"; $link =mysql_connect ($host, $db _user, $db _pass); mysql_select_db ($db _name,$ link); mysql_query ("SET names UTF8"); header ("content-type:text/html; Charset=utf-8 ");d Ate_default_timezone_set ($timezone); Beijing time? >~        

6. Restart Apache service, turn off firewall and SELinux

[Email protected] xyq]# systemctl restart Httpd.service
[Email protected] xyq]# Systemctl stop Firewalld.service
[Email protected] xyq]# Setenforce 0

Construction of dynamic website wishing wall under lamp environment

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.