CentOS 7.3+PHP7.2+mysql5.7+Workerman3安装

一、安装php
安装php扩展依赖

yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel bzip2-devel libpcre-devel libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 readline-devel 

下载php并解压:

wget http://cn2.php.net/distributions/php-7.2.0.tar.gz
tar -zxvf php-7.2.0.tar.gz
cd php-7.2.0

安装php及扩展包

./configure --prefix=/usr/local/php7  --sysconfdir=/etc/php7 --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-openssl --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --enable-exif  --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --with-gettext --enable-json --enable-mbstring --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --enable-shmop --enable-simplexml --enable-sockets --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-pcntl --enable-posix

编译

make && make install

配置系统环境变量
vi /etc/profile #加入下面

PATH=$PATH:/usr/local/php7/bin
export PATH

输入命令:source /etc/profile 使配置生效,通过php -v 查看版本信息
配置php-fpm

cp php.ini-production /etc/php.ini
cp /etc/php7/php-fpm.conf.default /etc/php-fpm.conf
cp /etc/php7/php-fpm.d/www.conf.default /etc/php7/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

启用php-fpm

/etc/init.d/php-fpm start

二、安装mysql5.7
Centos7默认数据库是mariadb,没有数据库的源,先下载mysql的repo源
1、下载mysql的源

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

2、安装mysql-community-release-el7-11.noarch.rpm

yum localinstall mysql-community-release-el7-11.noarch.rpm
ps:卸载源 yum remove XXXXXX

检查源安装情况:yum reposlist enabled | grep “mysql”
/etc/yum.repos.d/mysql-community.repo文件中改变默认安装mysql版本

3、安装mysql

yum install mysql-community-server

4 、mysql命令
ps:本文档基于centos7.3

systemctl start mysqld #启用mysql
systemctl status mysqld #查看mysql状态
systemctl enable mysqld #设置开启启动
systemctl daemon-reload #使开启启动的设置生效

5、修改root本地密码,先查看默认密码/var/log/mysqld.log

grep 'temporary password' /var/log/mysqld.log #查看密码

6、配置mysql,/etc/my.cnf,默认编码、数据存放文件等信息

[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
datadir=这里是数据文件存放文件夹

重启mysql

systemctl restart mysqld

未完,待安装workerman

你可能感兴趣的:(CentOS 7.3+PHP7.2+mysql5.7+Workerman3安装)