php7启用mysql5.7_centos7.2+php7.2+nginx1.12.0+mysql5.7配置

一. 源码安装php7.2

选择需要的php版本

从 php官网: http://cn2.php.net/downloads.php 选择需要的php版本,选择.tar.gz 的下载包,点击进入,选择中国的本地语言包,复制这个下载地址

84340bad0690717b70c2b8f21f751d61.png

c5fd9fd9856c3ed2eb7fe9756442de3c.png

选择一个位置存放文件

cd /usr/src/

下载刚刚选好的php压缩包

wget http://cn2.php.net/get/php-7.2.0.tar.gz/from/this/mirror

但是我们下载下来看到并不是我们要的php-7.2.0.tar.gz 类似的压缩文件,而是一个mirror的文件,很简单,我们给文件重命名就可以了

mv mirror php-7.2.0.tar.gz

安装php所需要的依赖

yum install gcc

yum install libxml2

yum install libxml2-devel

yum install openssl openssl-devel

yum -y install curl-devel

yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y

yum install bzip2-devel.x86_64 -y

yum install libXpm-devel

yum install gmp-devel

yum install -y icu libicu libicu-devel

yum install php-mcrypt libmcrypt libmcrypt-devel

yum install postgresql-devel

yum install libxslt-devel

1

2

3

4

5

6

7

8

9

10

11

12

13

4.解压编译

tar -xzxvf php-7.2.0.tar.gz

cd php-7.2.0

设置编译需要加载的模块

./configure --prefix=/usr/local/php --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu/--enable-ftp --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --with-iconv --with-xpm-dir=/usr

编译:

make clean && make && make install

5. 复制配置文件

cp php.ini-development /usr/local/php/lib/php.ini

6. 设置全局的php命令

vim /etc/profile

在文件最后添加:

PATH=$PATH:/usr/local/php/bin

export PATH

1

2

然后执行 命令 source /etc/profile

此时php就是全局命令了,可以通过php -v 查看php版本信息或者php -m 看看刚刚编译加载的模块了

配置PHP-fpm

cp /usr/local/php/etc/php

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值