php7.1安装

找到对应的镜像,右键复制链接地址这里下载的镜像是PHP7
http://cn2.php.net/get/php-7.1.0.tar.gz/from/this/mirror

最后通过wget下载这个地址里解析出来的文件就可以了。

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

我们在当前目录输入:

tar -zvxf mirror

centos就会将我们刚刚下载的PHP7解压到当前目录。ls查看我们会看到一个php7的文件夹。

安装依赖包

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

 

./configure --prefix=/usr/local/php7 \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip

6.正式安装

1
make && make install

7.配置环境变量

1
vi /etc/profile

在末尾追加

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

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

1
source /etc/profile

8.配置php-fpm

1
2
3
4
5
cp php.ini-production /etc/php.ini
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/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

1
/etc/init.d/php-fpm start
 
posted @ 2017-09-18 17:35  鸾舞春秋  阅读(2095)  评论(0编辑  收藏  举报