centos6.9 安装mysql8.0 和php7.3 的经历

26点 林涛 1101℃ 0评论

阿里云的服务器版本是centos6.9,之前安装的是LNMP,不过LNMP上的php版本太老,mysql也跟不上所以决定手动升级一下……,so,经过多次的尝试发现不是简单的升级lnmp上的mysql和PHP,最终决定手动配置环境:重新安装。

首先是安装php7.3的依赖,其实在安装lnmp的时候很多依赖已经安装了,如果是在搞不定就去问google,选定一年的时间范围;用google,你知道的。

首先安装依赖,如果已经安装过可以飘过此处:

yum groupinstall “Development Tools”

yum install libxml2-devel openssl-devel libcurl-devel gd-devel gmp-devel libicu-devel recode recode-devel libxslt libxslt-devel

进入安装php7.3的环节:

  1. 从官网下载php7.3
  2. tar zxvf php-7.3.0.tar.gz
  3. cd php-7.3.0/

./configure \
–prefix=/usr/local/php73 \
–with-config-file-path=/usr/local/php73/etc \
–disable-debug \
–disable-phpdbg \
–enable-mysqlnd \
–enable-bcmath \
–with-bz2=/usr \
–enable-calendar \
–with-curl \
–enable-exif \
–enable-fpm \
–with-fpm-user=www \
–with-fpm-group=www \
–with-freetype-dir \
–enable-ftp \
–with-gd \
–enable-gd-jis-conv \
–with-gettext=/usr \
–with-gmp \
–with-iconv \
–with-iconv-dir=/usr/local/libiconv \
–enable-intl \
–with-jpeg-dir \
–enable-mbstring \
–with-openssl \
–with-mhash \
–enable-pcntl \
–with-pdo-mysql=mysqlnd \
–with-png-dir \
–with-recode \
–enable-shmop \
–enable-soap \
–enable-sockets \
–enable-sysvmsg \
–enable-sysvsem \
–enable-sysvshm \
–enable-wddx \
–with-xmlrpc \
–with-xsl \
–with-zlib=/usr \
–enable-zip \
–with-libxml-dir=/usr \
–enable-xml \
–with-mysqli=mysqlnd \
–enable-fileinfo \
–enable-opcache \
–with-libdir=lib64 \
–enable-maintainer-zts

make
make install

cp php.ini-development /usr/local/php72/etc/php.ini

## 注:以上配置如果安装过程卡主的话需要去掉编译项,如果缺少什么直接yum安装,或者问google;

4. 修改php配置:

vim /usr/local/php72/etc/php.ini
# 找到 ;cgi.fix_pathinfo=1 修改为cgi.fix_pathinfo=0
# 找到 ;date.timezone = 修改为date.timezone = PRC

5. /usr/local/php72/bin/php -v  可以查看php版本

6.修改php-fpm配置文件

cp /usr/local/php72/etc/php-fpm.conf.default /usr/local/php72/etc/php-fpm.conf

找到 ;pid = run/php-fpm.pid 修改为

pid = /usr/local/php72/var/run/php-fpm.pid

8.常用命令:

service php-fpm73 start # 启动服务
service php-fpm73 stop # 停止服务
service php-fpm73 restart # 重启服务
service php-fpm73 reload # 平滑重启服务
service php-fpm73 force-quit # 强制退出服务
service php-fpm73 status # 查看服务状态
service php-fpm73 configtest # 检查配置

二 安装nginx

yum -y install make zlib pcre gcc gcc-c++ libtool openssl wget
yum install nginx -y
vim /etc/nginx/conf.d/default.conf
#注释掉这句
listen       [::]:80 default_server;

#启动服务
service nginx start
#设为开机自启动
chkconfig nginx on

三 安装mysql8.0

rpm -Uvh https://repo.mysql.com/mysql80-community-release-el6.rpmyum install -y mysql-community-server mysql-communitychkconfig --level 2345 mysqld on

如果出现类似如下错误:Unknown system variable ‘validate_password_policy’

mysql8.0需要入如下解决:

mysql> set global validate_password_policy=0;
ERROR 1193 (HY000): Unknown system variable ‘validate_password_policy’

mysql> set global validate_password_length=1;
ERROR 1193 (HY000): Unknown system variable ‘validate_password_length’

四 碰到的问题:

如果碰到提示“pear install PEAR-1.10.7”

解决:php pyrus.phar install pear/PEAR-1.10.7

错误:configure: error: libevent >= 1.4.11 could not be found 

解决:yum -y install libevent libevent-devel 

错误:configure: error: Please reinstall the mysql distributio 

解决:yum -y install mysql-devel 

错误:make: *** [sapi/fpm/php-fpm] error 1 

解决:用make ZEND_EXTRA_LIBS=’-liconv’编译 

如需转载请注明: 转载自26点的博客

本文链接地址: centos6.9 安装mysql8.0 和php7.3 的经历

转载请注明:26点的博客 » centos6.9 安装mysql8.0 和php7.3 的经历

喜欢 (0)
发表我的评论
取消评论

表情