媛媛*小怪兽
If you have choices,choose the best! If you have no choices,do the best! 人生就是不断在学习路上进步的!!!!!!

在安装php前先安装 nginx

1.创建php用户和用户组,并在github下载php7源码

# groupadd -r www && useradd -r -g www -s /bin/false -d /usr/local/php7 -M php
2.安装编译php7时需要的依赖包
# yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel
3.
3.PHP7编译参数的配置

  # cd /usr/local/src

# wget http://cn2.php.net/distributions/php-7.1.5.tar.gz
# tar zxvf php-7.1.5.tar.gz
# cd php-7.1.5
4.开始配置
# ./configure \
--prefix=/usr/local/php7 \
--exec-prefix=/usr/local/php7 \
--bindir=/usr/local/php7/bin \
--sbindir=/usr/local/php7/sbin \
--includedir=/usr/local/php7/include \
--libdir=/usr/local/php7/lib/php \
--mandir=/usr/local/php7/php/man \
--with-config-file-path=/usr/local/php7/etc \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-mcrypt=/usr/include \
--with-mhash \
--with-openssl \
--with-mysql=shared,mysqlnd \
--with-mysqli=shared,mysqlnd \
--with-pdo-mysql=shared,mysqlnd \
--with-gd \
--with-iconv \
--with-zlib \
--enable-zip \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--enable-opcache \
--enable-redis \
--enable-fpm \
--enable-fastcgi \
--with-fpm-user=www \
--with-fpm-group=www \
--without-gdbm \
--disable-fileinfo

5.开始编译和安装PHP7,相对编译安装MySQL的大量CPU和内存消耗,PHP7的编译安装轻松多了,整个过程大约1个小时左右。
# make clean && make && make install

温馨提示:

        部分编译出错的环境请使用

       #make ZEND_EXTRA_LIBS='-liconv';
       #make install

       编译安装完成PHP7!


下载到最后显示下图,PHP 7编译安装成功 

 

 

安装PHP7 还可参考地址  https://www.cnblogs.com/milton/p/6223813.html

https://blog.csdn.net/qq_29287973/article/details/78125125


posted on 2018-04-20 14:13  媛味君  阅读(705)  评论(0编辑  收藏  举报