php+7.1安装教程,CentOS7编译安装php7.1配置教程详解

CentOS7编译安装php7.1配置教程详解

这篇文章主要介绍CentOS7编译安装php7.1的过程和配置详解,亲测 ,需要的朋友可以参考。

1.首先安装依赖包:

1 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 zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-deve zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel

2.下载PHP压缩包并解压:

1 wget http://php.net/distributions/php-7.1.0.tar.gz

2 tar -zxvf php-7.1.0.tar.gz3 cd php-7.1.0

3.编译安装,编译的时候可能会出现各种报错情况:

./configure--prefix=/usr/local/php--with-config-file-path=/etc--enable-fpm--enable-inline-optimization--disable-debug--disable-rpath--enable-shared--enable-soap--with-libxml-dir--with-xmlrpc--with-openssl--with-mcrypt--with-mhash--with-pcre-regex--with-sqlite3--with-zlib--enable-bcmath--with-iconv--with-bz2--enable-calendar--with-curl--with-cdb--enable-dom--enable-exif--enable-fileinfo--enable-filter--with-pcre-dir--enable-ftp--with-gd--with-openssl-dir--with-jpeg-dir--with-png-dir--with-zlib-dir--with-freetype-dir--enable-gd-native-ttf--enable-gd-jis-conv--with-gettext--with-gmp--with-mhash--enable-json--enable-mbstring--enable-mbregex--enable-mbregex-backtrack--with-libmbfl--with-onig--enable-pdo--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-zlib-dir--with-pdo-sqlite--with-readline--enable-session--enable-shmop--enable-simplexml--enable-sockets--enable-sysvmsg--enable-sysvsem--enable-sysvshm--enable-wddx--with-libxml-dir--with-xsl--enable-zip--enable-mysqlnd-compression-support--with-pear--enable-opcache

全部复制以上代码一次执行。

4.编译成功后安装:

1 make && make install

注意:编译时可能会出现 make : ***[sapi/cli/php] error 1报错,解决方法:

1).$ vim Makefile

打开,Makefile文件,在EXTRA_LIBS最后面增加 -liconv 如:

XTRA_LIBS = -lcrypt -lz -lresolv -lcrypt -lreadline -ltermcap -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lxml2 -lssl -lcrypto -lcurl -lxml2 -lssl -lcrypto -lfreetype -lz -lpng12 -lxml2 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lxml2 -lssl -lcrypto -lcrypt-liconv

按Esc,按:wq保存退出。

2).$ make clean && make && make install

重新执行编译。

5.安装成功后配置环境变量:

1 vim /etc/profile

在 /etc/profile文件末尾添加php环境变量 :

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

export PATH

按Esc,:wq保存退出。

保存后刷新环境变量:

source /etc/profile

查看环境变量:

echo $PATH

看到php环境变量的路径后,以后就可以直接使用php命令了,查看php版本:

php -v

6.现在的PHP没有.ini文件和配置文件,还需要配置php-fpm:

1 cp php.ini-production /etc/php.ini2 cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf3 cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf4 cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm5 chmod +x /etc/init.d/php-fpm

php-fpm的启动、停止和重启:

1 service php-fpm start   #启动2 service php-fpm stop   #停止3 service php-fpm restart #重启

总结:

以上所述是CentOS7编译安装php7.1的教程详解,希望对大家有所帮助,如果大家有任何疑问欢迎留言交流!

CentOS7编译安装php7.1配置教程详解相关教程

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值