CentOS6.8服务器LAMP环境搭建(三) 源码安装php7.1.4

前端之家收集整理的这篇文章主要介绍了CentOS6.8服务器LAMP环境搭建(三) 源码安装php7.1.4前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

第一篇写了CentOS6.8服务器LAMP环境搭建(一) 安装Apache2.4.25,接下来接着CentOS6.8服务器LAMP环境搭建(二)使用cmake安装MySQL5.7.18,续写CentOS6.8服务器LAMP环境搭建(三) 源码安装PHP7.1.4。


1、将PHP源码安装包下载到/usr/local/src目录下

#cd /usr/local/src

# wgethttp://PHP.net/get/PHP-7.1.4.tar.gz/from/a/mirror


2、解压软件包

# tar -zxvfPHP-7.1.4.tar.gz


3、进入解压后的文件

# cdPHP-7.1.4


4、安装依赖

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

5、配置configure

./configure \
--prefix=/usr/local/PHP \
--exec-prefix=/usr/local/PHP \
--bindir=/usr/local/PHP/bin \
--sbindir=/usr/local/PHP/sbin \
--with-libdir=/usr/lib64 \
--disable-rpath \
--with-apxs2=/usr/local/apache2/bin/apxs \
--enable-fpm \
--with-config-file-path=/etc \
--with-libxml-dir \
--with-openssl \
--with-zlib=/usr/local/zlib \
--with-zlib-dir=/usr/local/zlib \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl=/usr/local/curl \
--enable-exif \
--with-pcre-dir=/usr/local/pcre/ \
--enable-ftp \
--with-openssl-dir \
--with-gd \
--with-jpeg-dir=/usr/local/jpeg9/ \
--with-png-dir=/usr/local/libpng \
--with-xpm-dir=/usr/include/X11/xpm.h \
--with-freetype-dir=/usr/local/freetype/ \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-mbstring \
--with-libmbfl \
--with-onig \
--with-mcrypt=/usr/include \
--with-MysqLi=shared,MysqLnd \
--with-pdo-MysqL=shared,MysqLnd \
--with-readline \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-xmlrpc \
--with-xsl \
--enable-zip \
--with-pear \
--enable-MysqLnd \
--enable-shared \
--enable-inline-optimization \
--disable-debug \
--enable-xml \
--with-sqlite3 \
--with-iconv \
--with-cdb \
--enable-dom \
--enable-fileinfo \
--enable-filter \
--enable-json \
--enable-mbregex \
--enable-mbregex-backtrack \
--enable-pdo \
--with-pdo-sqlite \
--enable-session \
--enable-simplexml \
--enable-opcache

6、编译安装

# make && make install

7、配置环境变量

编辑/etc/profile

在末尾追加:

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

执行命令使得改动立即生效:

# source /etc/profile


8、配置PHP-fpm

# cp PHP.ini-production /etc/PHP.ini
# cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf
# cp /usr/local/PHP/etc/PHP-fpm.d/www.conf.default /usr/local/PHP/etc/PHP-fpm.d/www.conf
# cp sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm
# chmod +x /etc/init.d/PHP-fpm


9、启动PHP-fpm
# /etc/init.d/PHP-fpm start


PHP安装完成,至此,lamp环境就搭建完成了,接下来会续写PHPMyAdmin的安装。

猜你在找的CentOS相关文章