第一步.安装PHP对应的源文件

1.安装epel-release

yum -y install epel-release


2.rpm 安装 添加Php7 相应的 yum源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

  

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

 

3.yum安装 php7

yum -y install php70w

   

4.安装php7和mysql数据库驱动

yum -y install php70w-mysqlnd

  

5.安装 mbstring拓展

yum -y install php70w-mbstring

 

6.安装fpm

yum -y install php70w-fpm

  

7.开启php-fpm服务

systemctl start php-fpm.service

  

systemctl enable php-fpm.service

  

8.显示版本

php -v



第二步(如果安装过了就只需要重启一下就可以了)


yum install httpd




service httpd start


修改httpd.conf配置文件(端口)

重启apache


systemctl restart httpd.service


第三步

1.安装Mysql对应的源文件

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm



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



yum install mysql-community-server

 

2.启动MySQL服务

service mysqld restart


3.配置密码

mysql -u root

 

4.修改密码

set password for 'root'@'localhost' =password('qwe123');


rpm -qa |grep mariadb

第四步.配置 Mysql

  1. mysql配置文件为/etc/my.cnf

    最后加上编码配置

   [mysql]    
   default-character-set =utf8    

这里的字符编码必须和/usr/share/mysql/charsets/Index.xml中一致。